I\'m trying to do java mail and im getting an error \"Cant send command to SMTP host\". Any help would be appreciated. And any future problems\' solutions if possible. The e
In my case, I was able to find the root problem after I enabled mailer debugging.
Different ways to enable mailer debugging:
java -Dmail.debug=true ...
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.debug", "true");
Jenkins config (/etc/default/jenkins):
JAVA_ARGS="-Dmail.smtp.starttls.enable=true -Dmail.debug=true"
More info: http://www.oracle.com/technetwork/java/faq-135477.html
My particular error was that I had an incorrect address in the "from:" line when the email was created. Google "G Suite" (google apps for business) requires the from-address to be in the same domain as the account owner. Eg. mycompanyname.com
The mailer debug revealed:
MAIL FROM: