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