EHLO isn't sent after STARTTLS
Per RFC3207, "The client SHOULD send an EHLO command as the first command after a successful TLS negotiation."
There are some email servers that enforce the RFC like Microsoft Exchange. Seeing this error when sending to an Exchange 2016 server: 503 5.5.2 Send hello first
This part of the code shows the 'hello' only being sent before STARTTLS I believe.
Currently a EHLO is sent after a STARTTLS, but maybe your Exchange Server supports HELO instead EHLO, but I doubt this. I made a tiny change in branch helo-after-starttls, you can test it, but only works if really your Exchange Server doesn't supports EHLO.
Can you please response with the complete Mail error message from this package?
Also, are you using LOGIN Auth? If yes, try another like PLAIN if server supports, if Exchange is behind a Firewall is possible AUTH command was stripped and this scenario can trigger this error too.
Hello xhit, thank you. It is behavior a user found and I haven't tested myself. Will be setting up an Exchange server for testing to confirm it is reproducible.
Also failed to note that part of the code, smtp.go, so a bit of an oversight on my end.
If the behavior is reproducible, I'll provide my findings.
Closed because package works as RFC3207 says, nothing to do here.