Whenever an email arrives for an address or domain assigned to you, the
entire message (including headers) is sent in a POST request to the URL you
specified, with Content-Type: multipart/rfc-822. In addition, the query
parameters "from" and "to" are set to the envelope sender and recipient,
respectively.
Here's how to use it in an App Engine application, when using App Engine's
webapp framework:
from google.appengine.ext import webapp
import email
class EmailHandler(webapp.RequestHandler):
def post(self):
sender = self.request.GET.get("from", "")
recipient = self.request.GET.get("to", "")
message = email.message_from_string(self.request.body)
# Do stuff with the email message