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 file_get_contents('php://input')
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();
Et voila.
Latest posts by Fab (see all)
- For Whom the Bells Tolls: review - 4 August 2024
- Self Aware On Air Neon Sign - 8 June 2024
- La Commune : review - 30 March 2024
Thanks! I was struggling with this, as you say, the Google docs don’t exactly spell this out!
Joel