python - Google Appengine 发送电子邮件 : [Error] unauthorized sender

标签 python google-app-engine email

我正在尝试在我的网站上使用 google app engine 的邮件服务。每当我访问发送电子邮件的页面时,它都会显示一些错误。该错误表明我正在使用未经授权的发件人来发送邮件。这是发送电子邮件的代码:

mail.send_mail(sender="myapp@appspot.gserviceaccount.com",
     to=input_dict["email"],
     subject="Mondays user activation",
     body=content)

当我在本地试用网站(使用 dev_appserver.py)时,它没有显示错误,但也没有发送电子邮件(注意:我必须添加 --enable_sendmail 选项,当我在本地尝试时)。该错误仅在我发布网站时出现。

有人知道我做错了什么吗?预先感谢您的帮助!

最佳答案

什么是 myapp@appspot.gserviceaccount.com?您可能无法从该地址发送邮件。

App Engine applications can send email messages on behalf of the app's administrators, and on behalf of users with Google Accounts.

The email address of the sender, the From address. The sender address must be one of the following types:

  • The address of a registered administrator for the application. You can add administrators to an application using the Administration Console.

  • The address of the user for the current request signed in with a Google Account. You can determine the current user's email address with the Users API. The user's account must be a Gmail account, or be on a domain managed by Google Apps.

  • Any valid email receiving address for the app (such as xxx@APP-ID.appspotmail.com).

  • Any valid email receiving address of a domain account, such as support@example.com. Domain accounts are accounts outside of the Google domain with email addresses that do not end in @gmail.com or @APP-ID.appspotmail.com.

https://developers.google.com/appengine/docs/python/mail/sendingmail

关于python - Google Appengine 发送电子邮件 : [Error] unauthorized sender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11621019/

相关文章:

python - 如何使用 Google Task Queues API 安排任务?

ruby-on-rails - Rails 邮件功能发送两次电子邮件

python - Django Rest Framework 上传文件到方法

google-app-engine - google app engine 无法创建 github 部署管道

android - 对于 Android,如何设置 Cloud Endpoint 请求的最长期限?

bash - 如果文件不为空,我该如何编写一个 shell 脚本,通过电子邮件将文件发送给我?

ios - 不使用电子邮件接受 Testflight Beta 邀请?

python - 如何在python中生成给定顶点数的所有3个正则图

python - 使用 `event` 的多处理暂停-重启功能

python - 将大数转换为字符 - Python