从python webapp2 Google App Engin发送电子邮件

2024-06-01 09:32:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试着从我的申请中发一封电子邮件。代码运行成功,没有错误。但它不发送电子邮件。它在控制台上显示此消息。在

You are not currently sending out real email. 
If you have sendmail installed you can use it by using the 
server with --enable_sendmail

谷歌提供的示例代码是:

^{pr2}$

Tags: you消息if电子邮件email错误notout
1条回答
网友
1楼 · 发布于 2024-06-01 09:32:17

这是因为dev_appserver默认情况下不发送真实的邮件。在

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

appcfg update /path/to/app/

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

^{pr2}$

或者另一个例子,使用gmail作为smtp提供者

dev_appserver /path/to/app  smtp_host=smtp.gmail.com  smtp_port=465 \
 smtp_user=user@gmail.com  smtp_password=password 

更多说明:https://cloud.google.com/appengine/docs/python/mail/

Mail and the development server

The development server can be configured to send email messages directly from your computer when you test a feature of your app that sends messages. You can configure the development server to use an SMTP server of your choice. Alternatively, you can tell the development server to use Sendmail, if Sendmail is installed on your computer and set up for sending email.

If you do not configure an SMTP server or enable Sendmail, when your app calls the Mail service, the development server will log the contents of the message. The message will not actually be sent.

相关问题 更多 >