Google App Engine Python python电子邮件不工作 [英] Google App Engine Python python email not working

查看:153
本文介绍了Google App Engine Python python电子邮件不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序工作正常了将近一年,但是突然无法发送电子邮件。没有任何异常提出,一切似乎都可以,但邮件没有交付我已经检查了整个邮箱,垃圾邮件文件夹和一切。以下是发送代码:

  mail.send_mail(sender =nikola825@gmail.com,#这是我的电子邮件,我是admin 
to = email,
subject =帐户验证,
body = emailContentsTXT

调用成功返回,不会抛出异常。当我尝试发送电子邮件时,配额仪表盘中发送的电子邮件数量会增加。

解决方案

缺少错误和在配额中发送的电子邮件的递增表示邮件发送工作正常。



确定邮件未到达目的地的唯一方法是检查已退回的电子邮件。您的应用需要配置为接收并处理已退回的电子邮件


要配置您的应用程序以接收退回的电子邮件通知:



1.添加遵循您的app.yaml文件启用通知:

  inbound_services:
- mail_bounce
   -  url:/ _ah / bounce 
脚本:handle_bounced_email.app
login:admin


所提及的文档还包含可能退回的消息处理程序的示例。 >

更新: OP观察到问题似乎是由URL引起的(对于 appspot.com domain)里面的电子邮件我注意到了这个GAE问题(仍然是开放和最近的活动),这是一个完美的匹配。


My application was working ok for almost a year now, but suddenly it can't send emails. There are no exceptions raised, everything seems ok, but the mails are not delivered I've checked the entire mailbox, spam folders and everything. Here is the sending code:

mail.send_mail(sender="nikola825@gmail.com",  #this is my email, I am the admin
               to=email,
               subject="Account verification",
               body=emailContentsTXT)

The call returns successfully, no exceptions are thrown. The number of sent emails in the Quotas dashboard gets increased when I try to send the email.

解决方案

The lack of errors and the incrementing of the sent emails in the Quotas indicate that message sending works fine.

The only way to determine why the messages are not reaching the destination is to check the bounced emails. Your app needs to be configured to receive and handle the bounced emails:

To configure your app to receive bounced email notifications:

1.Add the following to your app.yaml file to enable notification:

inbound_services:
- mail_bounce

2.Also in app.yaml, declare a mapping between /_ah/bounce and the bounce notification handler in your code, for example:

- url: /_ah/bounce
  script: handle_bounced_email.app
  login: admin

The mentioned doc contains examples of possible bounced message handlers as well.

Update: After the OP's observation that the issue seems caused by a URL (to an appspot.com domain) inside the email I noticed this GAE issue (still open and with quite recent activity) which appears a perfect match.

这篇关于Google App Engine Python python电子邮件不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆