How do I send email from Google App Engine with a random sender?

不问归期 提交于 2019-12-11 08:24:20

问题


How do I send email from Google App Engine with a random, non-app admin sender using a custom domain name (e.g. xyz@myshop.com ) ? We need to allow the users of our website to communicate with each other through a custom made messaging system but also allow them to reply directly from their email. Something similar with the craigslist system. However seems that GAE doesn't allow us to send email from an address that is not admin. Is there any workaround / patch ? We are the owner of myshop.com domain name (verified through google apps) so I don't see why a such thing is not allowed.


回答1:


While you can't use just any random address, you can use a registered administrator address with a '+' suffix. So you could send the mail with a 'from' of, say, message-reply+HASH_VALUE@myshop.com. Then your app will receive the reply, and can use the hash to decide which user to forward the mail to.




回答2:


How about sending the email from your admin account, but adding a reply-to header, specifying the user's email-address?




回答3:


Google doesn't allow to use random addresses. You can star this bug.

http://code.google.com/p/googleappengine/issues/detail?id=3069

However, since the users are apparently registered with Google Apps, the system can send emails on their behalf when they are signed into your application.

The sender address must be one of the following types:

...

  • The address of the user for the current request signed in with a Google Account. You can determine the current user's email address with the Users API. The user's account must be a Gmail account, or be on a domain managed by Google Apps.

http://code.google.com/appengine/docs/python/mail/emailmessagefields.html



来源:https://stackoverflow.com/questions/9489134/how-do-i-send-email-from-google-app-engine-with-a-random-sender

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!