The current documentation: https://cloud.google.com/appengine/docs/standard/python/mail/receiving-mail-with-mail-api
looks like it is for python27, otherwise in app.yaml entry should be:
- url: /_ah/mail/.+
script: auto (instead of handle_incoming_email.app)
login: admin
I can't find any documentation on how to receive incoming email on GAE StdEnv with Python3. I tried with:
app.yaml
runtime: python37
entrypoint: gunicorn -b :$PORT incoming_email.app
handlers:
- url: /_ah/mail/.+
script: auto
login: admin
inbound_services:
- mail
requirements.txt
ez_setup
gunicorn
google-appengine
incoming_email.py
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
import webapp2
class LogSenderHandler(InboundMailHandler):
"""."""
def receive(self, mail_message):
"""Do things with mail_message"""
app = webapp2.WSGIApplication([
('/_ah/mail/', LogSenderHandler)
], debug=True)
But when deploying, google-appengine can't build:
Error ID: 4646FF8A. Error type: InternalError. Error message: `pip_download_wheels` had stderr output: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-wheel-80z20v2n/google-appengine/
error: `pip_download_wheels` returned code: 1.
google-appengine is needed to import the InboundMailHandler, but looks like google-appengine pip install is for Python 2? Anyone able to receive emails with Python3?
Thanks!