从python webapp2 Google应用程序引擎发送电子邮件

从python webapp2 Google应用程序引擎发送电子邮件,python,email,google-app-engine,webapp2,Python,Email,Google App Engine,Webapp2,我正在尝试从我的应用程序发送电子邮件。代码成功运行,但没有出现错误。但它不发送电子邮件。它在控制台上显示此消息 You are not currently sending out real email. If you have sendmail installed you can use it by using the server with --enable_sendmail 谷歌提供的示例代码是: message = mail.EmailMessage(

我正在尝试从我的应用程序发送电子邮件。代码成功运行,但没有出现错误。但它不发送电子邮件。它在控制台上显示此消息

You are not currently sending out real email. 
If you have sendmail installed you can use it by using the 
server with --enable_sendmail
谷歌提供的示例代码是:

message = mail.EmailMessage(
                    sender="shaizi9687@gmail.com",
                    subject="Your account has been approved")

message.to = "ABC <shahzebakram@hotmail.com>"
message.body = """Dear Albert:
Your example.com account has been approved.  You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
"""
message.send()
message=mail.EmailMessage(
发送方=”shaizi9687@gmail.com",
主题=“您的帐户已被批准”)
message.to=“ABC”
message.body=“”亲爱的Albert:
您的example.com帐户已获得批准。您现在可以访问
http://www.example.com/ 并使用您的Google帐户登录以
访问新功能。
如果您有任何问题,请告诉我们。
example.com团队
"""
message.send()

这是因为默认情况下,dev_appserver不会发送真正的邮件

当您推送到实时服务器时,电子邮件发送将起作用,例如:

appcfg update /path/to/app/
但正如错误消息所指出的,如果系统上安装了sendmail,则必须使用
--enable_sendmail
标志,或者使用smtp标志,例如:

dev_appserver /path/to/app/ --enable_sendmail=yes
或者另一个使用gmail作为smtp提供者的例子

dev_appserver /path/to/app --smtp_host=smtp.gmail.com --smtp_port=465 \
--smtp_user=user@gmail.com --smtp_password=password 
更多说明如下:

邮件和开发服务器

可以将开发服务器配置为发送电子邮件 当您测试应用程序的功能时,直接从您的计算机 发送消息。您可以将开发服务器配置为使用 您选择的SMTP服务器。或者,您可以告诉 如果服务器上安装了Sendmail,则开发服务器将使用Sendmail 计算机和设置发送电子邮件

如果未配置SMTP服务器或启用Sendmail,则 应用程序调用邮件服务,开发服务器将记录 消息的内容。消息实际上不会被发送