Python 这是我的接收电子邮件代码,但可以';我没有收到电子邮件。。(谷歌应用引擎)
app.yaml:Python 这是我的接收电子邮件代码,但可以';我没有收到电子邮件。。(谷歌应用引擎),python,google-app-engine,Python,Google App Engine,app.yaml: 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):
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="zjm1126@gmail.com ",subject="reply to "+_subject)
#m.to = _sender
#m.body =allBodies
#m.send()
message = mail.EmailMessage(sender="zjm1126@gmail.com",
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)
我使用我的电子邮件:zjm1126@gmail.com发几句话给ss@zjm1126.appspotmail.com
我无法收到电子邮件,为什么?看起来您正试图从邮件中生成代码以使其正常工作。我还使用了那个教程来检查邮件服务是如何工作的,并且没有遇到任何问题。我可以建议做的是:
希望这能有所帮助,因为看起来您正在尝试将代码从邮件转换为工作状态。我还使用了那个教程来检查邮件服务是如何工作的,并且没有遇到任何问题。我可以建议做的是:
希望这对您有所帮助,注意一切看起来都很好-您的处理程序返回200 OK。如果您没有收到它发送的电子邮件,请尝试记录您正在使用的值,以便检查所有内容是否有效以及您期望的内容。一切正常-您的处理程序返回200 OK。如果您没有收到它发送的电子邮件,请尝试记录您正在使用的值,以便检查所有内容是否有效以及您期望的内容。在阅读谷歌教程后,我也遇到了同样的问题。多亏了谷歌,我发现了一段相当重要的代码,这段代码我忘记了,不在谷歌教程中
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
希望这能有所帮助。在学习了谷歌教程之后,我也遇到了同样的问题。多亏了谷歌,我发现了一段相当重要的代码,这段代码我忘记了,不在谷歌教程中
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
希望有帮助