Closed jerrygaoLondon closed 1 year ago
Did you end up making progress on this?
Looks like this might have something to do with SNI.
Unfortunately, smtplib
is becoming a lot easier to use, so I'm going to migrate to that until this is fixed.
You can fix it very simple.
Just edit you local copy of marrow.mailer transport/smtp.py
row 74
from
connection = SMTP(local_hostname=self.local_hostname, timeout=self.timeout)
to
connection = SMTP(host=self.host, port=self.port, local_hostname=self.local_hostname, timeout=self.timeout)
And
row 84
from
connection.starttls(self.keyfile, self.certfile)
to
connection.starttls()
Reaaly, U can make changes more effective for you. But this code show an idea for U.
Closing as… "won't fix"? "Already fixed?" "Upstream issue, not my problem?"
See the discussion on #83 and the associated (rejected) pull requests. This "fix", while seemingly required until CPython fix their ████, suffers a notable disadvantage. It is, however, conditionally applied in situations where it is required in my downstream work branch:
marrow/mailer/transport/smtp.py
Applying this fix will immediately attempt to connect on instantiation, not first use, and prevents the assignment of a debug level for diagnostic use prior to that attempt to connect. It's a "fix, with defects," which made those PRs unacceptable.
With slack time to update my projects, this fix will get incorporated "Real Soon Now™", once I get a chance to finish off modernized Python 3 packaging.
Following the example code, i'm trying to setup marrow.mailer with gmail. There is no indication for any failure. But, after debugging, it actually throws
[SSL: TLSV1_UNRECOGNIZED_NAME] tlsv1 unrecognized name (_ssl.c:600)
inresult
My code is as follows:
With exactly same setting, using
smtplib
works well.