Receiving e-mails
Receiving e-mails is pretty much a simple thing in Google App Engine. First, you have to enable the incoming e-mails for your app. This can only be done in your app.yaml
file (as there's nothing on the application settings when deployed). To do this, you add the following line to app.yaml
:
inbound_services: - mail
Now, how are the e-mails delivered to your app? Can you pull them on your own? The answer is that the e-mails are delivered to your application as HTTP POST
requests. So, which URL do they hit? That's actually /_ah/mail/address
, where address
is the e-mail address to which the e-mail is sent.
The e-mail address should be of the following form:
account@appid.appspotmail.com
Here, account
can be anything that you like, and appid
is your application ID from app.yaml
. To handle the incoming requests at sales@myapp.appspotmail.com
, you can have the following handler:
- url: /_ah/mail/sales@myapp\.appspotmail\.com script: my_email_handler.app login: admin
Let's look at the...