Python Webapp2 GAE电子邮件发送问题

时间:2016-12-19 15:16:47

标签: python email google-app-engine webapp2

我正在开展一个项目,我正在向该用户发送电子邮件。在消息正文中我发送自定义消息,它工作正常,但当我为链接验证添加另一个变量时,它确实发送了电子邮件,但我没有收到它。但是,当我再次删除该链接验证变量时,它会发送电子邮件,我也会收到它。请帮助我做错了。

以下是正常运行的代码:

email = "a@gmail.com"
text = "from date: " + str(from_date) + " to date: " + str(to_date) + " Total Price: " + str(price)

message = mail.EmailMessage(
    sender="abc@gmail.com",
    subject="Booking Confirmation"
)

message.to = email
message.body = """Dear """ + name + """:
               """"""
               Please note date and time
               """ + text + """.

               Please let us know if you have any questions.
               """
message.send()

以下是无效的代码:

email = "a@gmail.com"
text = "from date: " + str(from_date) + " to date: " + str(to_date) + " Total Price: " + str(price)
link = "http://abc.appspot.com/place/confirm/?place_id=" 
message = mail.EmailMessage(
    sender="abc@gmail.com",
    subject="Booking Confirmation"
)

message.to = email
message.body = """Dear """ + name + """:
               """+link+"""
               Please note date and time
               """ + text + """.

                Please let us know if you have any questions.
                """
message.send()

1 个答案:

答案 0 :(得分:1)

这不是一个错误,问题是包含*.appspot.com域名的链接,结合新应用(即尚未信任),触发了现在更严格的Google infra反垃圾邮件措施。

请参阅GAE Issue 12786

如果您的应用没有发送垃圾邮件,请联系该主题中提到的电子邮件地址,他们可能拥有针对较新应用的手动维护白名单。