Incoming emails to live app are rejected

64 views
Skip to first unread message

John Barham

unread,
Feb 4, 2016, 10:52:05 PM2/4/16
to Google App Engine
I'm testing incoming email URLs in a new app and am stumped why they work in the dev server but not in the live app. My app files are:

app.yaml:

version: 1
runtime: python27
api_version: 1
threadsafe: true

inbound_services:
- mail

handlers:
- url: /.*
  script: hello.app
- url: /_ah/mail/.+
  script: hello.app
  login: admin

hello.py:

import logging
import webapp2
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')

class MailHandler(InboundMailHandler):
    def receive(self, msg):
        logging.info("Received a message from: %s, subject: %s", msg.sender, msg.subject)

app = webapp2.WSGIApplication([
    ('/_ah/mail/', MailHandler),
    ('/', MainPage),
], debug=True)

The expected log message is printed by the dev server when I "send" a test email using the dev admin web interface, but when I send an email to the live app (i.e., te...@myappid.appspotmail.com), it logs a 404 in the log and returns a bounce message saying "Delivery to the following recipient failed permanently". Any ideas?

Alex Martelli

unread,
Feb 6, 2016, 12:28:19 AM2/6/16
to google-a...@googlegroups.com
I would change

app = webapp2.WSGIApplication([
    ('/_ah/mail/', MailHandler),

to

app = webapp2.WSGIApplication([
    ('/_ah/mail/.+', MailHandler),


Alex

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/d3b8d23c-ae2c-4588-9523-27580dde8350%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages