Error sending e-mail via SMTP server on App Engine development server

前端 未结 5 1614
北荒
北荒 2020-12-31 08:25

I am trying to send Email using this sample code and these command-line options:

dev_appserver.py --smtp_host=smtp.gmail.com --smtp_port=25 --smtp_user=xxx@g         


        
5条回答
  •  感动是毒
    2020-12-31 09:10

    dev_appserver.py doesn't support TLS which is required by Gmail. You can enable it by adding a few lines in api/mail_stub.py:

    # After smtp.connect(self._smtp_host, self._smtp_port)
    smtp.ehlo()
    smtp.starttls()
    smtp.ehlo()
    

    Note! That's the quick and dirty solution. You should add some kind of flag to tell it whether you want to use TLS or not, as it is not always desired.

提交回复
热议问题