Merge pull request #112 from ahubaoan/dev_for_tp4a

修改smtp发送邮件部分,只在25和587开启startls
pull/113/head
Apex Liu 2018-09-29 13:28:04 +08:00 committed by GitHub
commit 037398d566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ def tp_send_mail(recipient, message, subject=None, sender=None, cc=None, bcc=Non
if dbg_mode:
_smtp.set_debuglevel(1)
_smtp.ehlo()
if _smtp.has_extn("starttls"):
if (_port == 25 or _port == 587) and _smtp.has_extn("starttls"):
_smtp.starttls()
else:
_smtp = smtplib.SMTP(_server, _port, timeout=10.0)