I'm playing around with web2py for the first time on a project that is
using GAE to accept and process inbound email.  When mail comes in to
GAE, you need to tell it what piece of code to run in your app.yaml to
handle it:

- url: /_ah/mail/.+
  script: applications/myapp/modules/incoming.py
  login: admin

So my first question is where should I put the code that will handle
this mail?  Is it a module?  A controller?

I based my rough prototype on the code from Google (http://
code.google.com/appengine/docs/python/mail/receivingmail.html), which
obviously has no knowledge of web2py.  However, in that code I want to
store some data to the DB, using the model that I've defined in my
db.py file.  Unfortunately, I'm getting the "NameError: global name
'db' is not defined" message when I try to do a query on the db.  The
same code works fine if I stick it in the default controller of my
app, so I'm curious what I need to do to make the two worlds connect
(i.e. requests that come in through GAE inbound mail, and the rest of
my app).

-Mike

Reply via email to