【发布时间】:2014-08-01 09:49:54
【问题描述】:
在我的应用中,每当我尝试接收我的应用的电子邮件并向 receive() 方法发送请求时,我都会收到错误 405 Method Not Allowed。
通过 id string@appid.appspotmail.com 发送电子邮件可以正常工作,但接收到此 id 的电子邮件会导致此错误。
我这样配置我的应用程序
app.yaml
application: abc
version: 1
runtime: python27
api_version: 1
threadsafe : false
inbound_services:
- mail
handlers:
- url: /_ah/mail/.+
script: incoming_mail.py
login: admin
- url: /
script: abc.py
incoming_mail.py
import email
import logging
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,email):
logging.info("Received a message from: %s" % email.sender)
app = webapp.WSGIApplication([LogSenderHandler.mapping()], debug=True)
def main():
run_wsgi_app(app)
if __name__ == "__main__":
main()
每当我通过这个网址http://appid.appspot.com/_ah/mail/string@appid.appspotmail.com
我收到错误405 Method not allowed。
完全卡住了。提前感谢您提供的任何帮助!
【问题讨论】:
标签: python google-app-engine email