python - Google App Engine 中的邮件收发(reply_to 字段)

标签 python google-app-engine

我正在阅读有关在 GAE 中发送/接收邮件的信息,我对如何使用 reply_to 以及回复的电子邮件地址的形式有疑问。

我的 register.py 只是将 message.sender 写入数据库:

class User(db.Model):
    userEmail = db.StringProperty()
    userEmailContent = db.StringProperty()

class Register(InboundMailHandler):
    def receive(self, message):        
        newUser = User(userEmail = message.sender)        
        db.put(newUser)

application = webapp.WSGIApplication([
  Register.mapping()
], debug=True)

def main():
    run_wsgi_app(application)
if __name__ == "__main__":
    main()

来自 incoming.py 我正在用这封电子邮件回复申请人的邮件:

mail.send_mail(sender="<az@example.com>",
               to=message.sender,
               body="reply to this email to register"
               reply_to=/_ah/mail/register@hello-1-world.appspotmail.com)

我在想象,当申请人回复这封邮件时,register.py会处理这封邮件,将申请人的邮件地址写入数据库。我不确定如何在开发服务器中测试它。在部署该应用程序之前,我想询问有关分配给 reply_to 的正确电子邮件地址的建议,以及这是否是处理此问题的正确方法。谢谢。

最佳答案

reply_to 地址应该是没有 /_ah/mail/ 前缀的规范电子邮件地址,它遵循与 发件人 相同的限制邮件地址。

The sender address of a message must be the email address of an administrator for the application, the Google Account email address of the current user who is signed in, or any valid email receiving address for the app.

要在您的开发服务器上测试它,您可以配置 sendmail并从您的程序发送邮件。
收到后,点击邮件客户端的回复应该会显示代码中设置的 reply_to 邮件地址。

关于python - Google App Engine 中的邮件收发(reply_to 字段),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4271958/

相关文章:

python - 导入错误: cannot import name 'json_normalize' from 'pandas.io.json'

Python 请求,返回 : Unexpected character encountered while parsing value: L. 路径

python - 如何使用 python 在 google app engine blobstore 上创建一个简单的虚拟文件系统?

python-2.7 - 如何在 AppEngine for Python 中导入 BigQuery

python - GAE 和 Facebook 连接 : How to get age and gender of user?

python - 将列表值转换为 pandas 中的行

python - 将数据框日期行转换为周末/非周末值

python - 配置文件 Python 导入时间

google-app-engine - SSL 谷歌应用引擎

java - 如何自动重试在 GAE 后端执行的任务?