[Python] google appengine receive email error

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm in trouble. I'm playing now for a long time with receiving email in google apps but in my application Logs only get this:

    0.1.0.20 - - [13/Jun/2013:08:42:23 -0700] "POST /_ah/mail/contact@myappid.appspotmail.com HTTP/1.1" 200 0 - - "myappid.appspot.com" ms=69 cpu_ms=0 cpm_usd=0.100008 app_engine_release=1.8.1 instance=00c61b117c2fb913155f167711d12979c818fd


    My mail handler script schould be this: mailmain.py

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

    class LogSenderHandler(InboundMailHandler):
    def receive(self, mail_message):
    tobesent = mail_message.subject
    logging.info("From: " + mail_message.sender)
    logging.info("To:" + mail_message.to)
    logging.info("Subject: " + mail_message.subject)
    logging.info("Date: " + mail_message.date)

    app = webapp2.WSGIApplication([LogSenderHandler.mapping()], debug=True)


    and my app.yaml is this:

    application: myappid
    version: 1
    runtime: python27
    api_version: 1
    threadsafe: no

    handlers:
    - url: /favicon\.ico
    static_files: favicon.ico
    upload: favicon\.ico

    - url: /_ah/mail/contact@myappid.appsportmail.com
    script: mailmain.py
    login: admin

    - url: /.*
    script: mailmain.py

    inbound_services:
    - mail


    I've tried playing with the script so I have many versions, some ending in this (if this matters) but really nothing works:

    def main():
    app = webapp2.WSGIApplication([LogSenderHandler.mapping()], debug=True)
    run_wsgi_app(application)
    if __name__ == "__main__":
    main()


    I do have a favicon.ico uploaded as well.

    Googled the error up for hours and hours and nothing works. Here on Stackoverflow I've found for similar error message solutions such as correct recieve into receive but this is not the case here. I've copied other solutions as well, also this from GITHUB so I believe this question is not a duplicate.

    Continue reading...

Compartilhe esta Página