Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 578805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:17:58+00:00 2026-05-13T14:17:58+00:00

The documentation is rather incomplete. I could not set up the inbound email. Here

  • 0

The documentation is rather incomplete. I could not set up the inbound email. Here are some details:

app.yaml:

handlers:

- url: /_ah/mail/owner@oladic\.appspotmail\.com
  script: handle_owner.py
  login: admin

- url: /_ah/mail/support@oladic\.appspotmail\.com
  script: handle_support.py
  login: admin

- url: /_ah/mail/.+
  script: handle_catchall.py
  login: admin

- url: .*
  script: main.py

inbound_services:
- mail

handle_catchall.py:

# To change this template, choose Tools | Templates
# and open the template in the editor.

import logging, email

from google.appengine.api import mail
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler

class LogSenderHandler(InboundMailHandler):
    def receive(self, mail_message):
        logging.info("================================")
        logging.info("Received a message from: " + mail_message.sender)
        plaintext_bodies = message.bodies('text/plain')
        html_bodies = message.bodies('text/html')

        for content_type, body in html_bodies:
            decoded_html = body.decode()
            logging.info("content_type: " + content_type)
            logging.info("decoded_html: " + decoded_html)

        attachments = []
        if message.attachments:
            if isinstance(message.attachments[0], basestring):
                attachments = [message.attachments]
            else:
                attachments = message.attachments

        logging.info("number of attachments: " + str(len(attachments)))

        for filename, content in attachments:
            logging.info("plaintext_bodies: " + plaintext_bodies)
            logging.info("filename: " + filename)
            content

        logging.info("--------------------------------")



def main():
    application = webapp.WSGIApplication([LogSenderHandler.mapping()], debug=True)
    wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:17:58+00:00Added an answer on May 13, 2026 at 2:17 pm

    I checked that found some trivial bugs/mistakes. Will update later.

    No more issues. Here’s the code of working example:

    handle_catchall.py:

    import logging, email
    import wsgiref.handlers
    import exceptions
    
    from google.appengine.api import mail
    from google.appengine.ext import webapp
    from google.appengine.ext.webapp.util import run_wsgi_app
    from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
    
    class LogSenderHandler(InboundMailHandler):
        def receive(self, mail_message):
            logging.info("================================")
            logging.info("Received a mail_message from: " + mail_message.sender)
            logging.info("The email subject: " + mail_message.subject)
            logging.info("The email was addressed to: " + str.join(str(mail_message.to), ', '))
    
            try:
                logging.info("The email was CC-ed to: " + str.join(str(mail_message.cc), ', '))
            except exceptions.AttributeError :
                logging.info("The email has no CC-ed recipients")
    
            try:
                logging.info("The email was send on: " + str(mail_message.date))
            except exceptions.AttributeError :
                logging.info("The email has no send date specified!!!")
    
            plaintext_bodies = mail_message.bodies('text/plain')
            html_bodies = mail_message.bodies('text/html')
    
            for content_type, body in html_bodies:
                decoded_html = body.decode()
                logging.info("content_type: " + content_type)
                logging.info("decoded_html: " + decoded_html)
                plaintext_bodies
    
            attachments = []
            # hasattr(a, 'property')
            # http://stackoverflow.com/questions/610883/how-to-know-if-an-object-has-an-attribute-in-python
            try:
                if mail_message.attachments :
                    if isinstance(mail_message.attachments[0], basestring):
                        attachments = [mail_message.attachments]
                    else:
                        attachments = mail_message.attachments
            except exceptions.AttributeError :
                logging.info("This email has no attachments.")
    
            logging.info("number of attachments: " + str(len(attachments)))
    
            for filename, content in attachments:
                #logging.info("plaintext_bodies: " + plaintext_bodies)
                logging.info("filename: " + filename)
                content
    
            logging.info("--------------------------------")
    
    
    
    def main():
        application = webapp.WSGIApplication([LogSenderHandler.mapping()], debug=True)
        wsgiref.handlers.CGIHandler().run(application)
    
    
    if __name__ == '__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently writing some extensive documentation using Sphinx for a rather complex Django
I'm looking on the datatables.net website for some clarification or documentation rather about what
I've written this documentation of a rather simple class, but I feel it's not
The PHP documentation can be found here , but I think it's rather lacking.
The documentation for [Ignition][1] is rather sparse. I'm looking at the documentation for the
Python documentation to Popen states: Warning Use communicate() rather than .stdin.write, .stdout.read or .stderr.read
The documentation for .NET's Excel interop API at msdn.com seems rather sparse. Does anyone
Documentation: https://developers.facebook.com/docs/achievements/ Each achievement must possess a unique URL with the appropriate Open Graph
The documentation is rather poorly written when talking about playing audio in the background.
I've tried reading the documentation but it is rather impenetrable so I'm hoping someone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.