Fix SMTP AUTH extension not supported by server error on some SMTP servers

Issue #12
This commit is contained in:
Sean Whalen
2018-09-19 08:01:30 -04:00
parent c051980f26
commit 0989a8bb8a
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -9,6 +9,8 @@ GeoIP DB to avoid being blocked by security proxies
- Add alignment booleans to JSON output
- Fix `.msg` parsing CLI exception when `msgconvert` is not found in the
system path
- Fix `SMTP AUTH extension not supported by server` error on some SMTP servers
(#12)
3.9.7
-----
+2
View File
@@ -1438,9 +1438,11 @@ def email_results(results, host, mail_from, mail_to, port=0, starttls=True,
ssl_context = ssl.create_default_context()
if use_ssl:
server = smtplib.SMTP_SSL(host, port=port, context=ssl_context)
server.connect(host, port)
server.helo()
else:
server = smtplib.SMTP(host, port=port)
server.connect(host, port)
server.ehlo()
if starttls:
server.starttls(context=ssl_context)