There is not so much documentation on how to receive an email on Google App Engine (gae) with PHP. The official documentation is not really explicit, I guess it is because it is still experimental as I write.
After fighting some time, here is how to do it.
configure app.yaml with the following:
- url: /_ah/mail/.+ script: handle_incoming_email.php login: admin inbound_services: - mail
Here, I redirect every received email to handle_incoming_email.php.
In handle_incoming_email.php, the content of the received email is available not in
$_POST, but in
With the help of Plancake email parser, it becomes easy to get the content:
$emailParser = new PlancakeEmailParser(file_get_contents('php://input')); $email_body = $emailParser->getBody();