Hey,
I have recently battled with not being able to send emails using the smtp server provided by the client.
I narrowed down the problem to emails being sent using TLS doing this
if self.settings.tls and not self.settings.ssl:
server.ehlo()
server.starttls()
server.ehlo()
Turns out smtplib.ehlo() doesn't always give an acceptable hostname for what ESMTP servers want, like the domain you're actually using and the server will deny you if it's not accepting relays.
Can we change this to something like this:
if self.settings.tls and not self.settings.ssl:
server.ehlo(self.settings.hostname)
server.starttls()
server.ehlo(self.settings.hostname)
Putting the hostname there, finally solved my problem but it wasn't a fun night.