“NoneType”对象在AppEngine mail send中不可读取

2024-05-31 23:52:10 发布

您现在位置:Python中文网/ 问答频道 /正文

在我的本地服务器上,我在尝试发送邮件时遇到此错误

INFO 2017-03-01 16:54:06,819 mail_stub.py:143] MailService.Send
From: None "no-reply@None.appspotmail.com"
To: v*****@d******.com
Subject: Du contenu arrive à expiration (alldigital@test.gpartner.eu)
Body:
Content-type: text/plain
Data length: 50
INFO 2017-03-01 16:54:06,819 mail_stub.py:306] You are not currently sending out real email. If you have sendmail installed you can use it by using the server with --enable_sendmail

ERROR 2017-03-01 16:48:43,630 wsgi.py:279] Traceback (most recent call last):
File "/home/*****/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 268, in Handle
for chunk in result:
TypeError: 'NoneType' object is not iterable

我的代码是:

def send(recipient, subject, body):
    message = mail.EmailMessage(
        sender=u'{} <no-reply@{}.appspotmail.com>'.format(app_identity.get_application_id(),
                                                           app_identity.get_application_id()),
        subject=subject,
        body=body,
        to=recipient
    )
    message.check_initialized()
    message.send()

我不知道怎么回事。你有什么可以解决这个问题的吗?或者我可以试着调试一些东西吗?在

谢谢你的帮助


Tags: nopyinfocomnoneyoumessagegoogle
2条回答

在您的日志中,这是发送电子邮件的地址:

From: None "no-reply@None.appspotmail.com"

我从未使用过app_identity.get_application_id(),但它返回“None”后对您不起作用。与其对此进行深入研究,不如对app id进行硬编码,看看能否解决问题,即:

sender=u'no-reply@myapp.appspotmail.com'

好吧,我的错。这与邮件无关,我只是在路由处理程序的末尾没有返回任何内容。错误就来自于此。谢谢你的帮助。

相关问题 更多 >