Google App Engine中的邮件收发(reply_to字段) [英] Mail send-receive in Google App Engine (reply_to field)

查看:800
本文介绍了Google App Engine中的邮件收发(reply_to字段)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读关于GAE中的邮件发送/接收的内容,并且我有一个关于如何使用 reply_to 和回复的电子邮件地址表单的问题。


$ b $ my 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(应用程序)
if __name__ ==__main__:
main()

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

  mail.send_mail(sender =< az@example.com>,
to = me ssage.sender,
body =回复此邮件注册
reply_to=/_ah/mail/register@hello-1-world.appspotmail.com)

我想象当申请人回复这封电子邮件时, register.py 会处理电子邮件并将申请人的电子邮件地址写入数据库。我不知道如何在dev服务器中测试这个。在部署应用程序之前,我想询问有关要分配给 reply_to 的正确电子邮件地址的建议,以及这是否是处理此问题的正确方法。 / _ ah / mail / 前缀,它遵循发件人邮件地址的相同限制。


邮件的发件人地址必须是管理员的
电子邮件地址,用于
应用程序,Google帐户

登录的当前用户的电子邮件地址,或该应用的任何有效的电子邮件
接收地址。

要在您的开发服务器上测试它,您可以配置 sendmail 并从您的程序发送邮件。

收到邮件后,单击您的邮件客户端的回复应显示您的代码中设置的reply_to邮件地址。


I am reading about mail send/receive in GAE and I have a question about how to use reply_to and the form of the email address replied to.

My register.py simply writes message.sender to database:

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()

From incoming.py I am replying to an applicant's mail with this email:

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)

I am imagining that when the applicant replies to this email register.py will handle the email and write the applicant's email address to the database. I am not sure how to test this in dev server. Before deploying the app I wanted to ask advice about the correct email address to assign to reply_to and if this is the correct way of handling this. Thanks.

解决方案

The reply_to address should be a canonical email address without the /_ah/mail/ prefix and it follows the same restriction of the sender mail address.

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.

To test it on your dev server, you could configure sendmail and send a mail from your program.
Once received, clicking reply from your mail client should show the reply_to mail address set in your code.

这篇关于Google App Engine中的邮件收发(reply_to字段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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