Sending mail from Python using SMTP

后端 未结 13 779
半阙折子戏
半阙折子戏 2020-11-28 17:27

I\'m using the following method to send mail from Python using SMTP. Is it the right method to use or are there gotchas I\'m missing ?

from smtplib import SM         


        
相关标签:
13条回答
  • 2020-11-28 18:21

    Also if you want to do smtp auth with TLS as opposed to SSL then you just have to change the port (use 587) and do smtp.starttls(). This worked for me:

    ...
    smtp.connect('YOUR.MAIL.SERVER', 587)
    smtp.ehlo()
    smtp.starttls()
    smtp.ehlo()
    smtp.login('USERNAME@DOMAIN', 'PASSWORD')
    ...
    
    0 讨论(0)
提交回复
热议问题