The SMTPAuthenticator is complex unnecessarily. It should override only the method getPasswordAuthentication().