import logging, email
from google.appengine.ext import webapp
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
from google.appengine.ext.webapp.util import run_wsgi_app
class LogSenderHandler(InboundMailHandler):
def receive(self, message):
_subject = message.subject
_sender=message.sender
bodies = message.bodies('text/plain')
allBodies = ""
#for body in bodies:
# allBodies = allBodies + "\n---------------------------\n" + body[1].decode()
#m= mail.EmailMessage(sender="[email protected] ",subject="reply to "+_subject)
#m.to = _sender
#m.body =allBodies
#m.send()
message = mail.EmailMessage(sender="[email protected]",
subject="Your account has been approved")
message.to = _sender
message.body = """
Dear Albert:
Your example.com account has been approved. You can now visit
http://www.example.com/ and sign in using your Google Account to
access new features.
Please let us know if you have any questions.
The example.com Team
"""
message.send()
application = webapp.WSGIApplication([LogSenderHandler.mapping()], debug=True)
app.yaml:
application: zjm1126
version: 1-2
runtime: python
api_version: 1
inbound_services:
- mail
handlers:
- url: /media
static_dir: media
- url: /_ah/mail/.+
script: handle_incoming_email.py
login: admin
- url: /
script: a.py
- url: /sign
script: a.py
- url: .*
script: django_bootstrap.py
i use my email:[email protected] send some words to [email protected]
but i can't get a Receiving Email, why ???
thanks
and this is the log: