Google Appengine发送电子邮件:[错误]未经授权的发件人 [英] Google Appengine sending emails: [Error] unauthorized sender

查看:161
本文介绍了Google Appengine发送电子邮件:[错误]未经授权的发件人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的网站上使用谷歌应用引擎的邮件服务。当我访问发送电子邮件的页面时,它显示一些错误。错误说我正在使用未经授权的发件人发送邮件。以下是发送电子邮件的代码:

  mail.send_mail(sender =myapp@appspot.gserviceaccount.com,
to = input_dict [email],
subject =星期一用户激活,
body = content)

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



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

解决方案

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


App Engine应用程序可以代表应用程序的
发送电子邮件管理员和代表Google帐户的用户。



发件人的电子邮件地址,发件人地址。发件人地址
必须是以下类型之一:




  • 应用程序的注册管理员的地址。您可以使用管理
    控制台将管理员添加到应用程序。


  • 使用Google帐户登录的当前请求的用户地址。您可以使用Users API确定当前用户的电子邮件地址
    。用户的帐户必须是Gmail帐户,或者由Google Apps管理的域名为


  • 任何有效的电子邮件接收地址例如xxx@APP-ID.appspotmail.com)。


  • 任何有效的电子邮件接收域帐户的地址,例如support@example.com。域帐户是
    Google域之外的帐户,电子邮件地址不能在@ gmail.com或
    @ APP-ID.appspotmail.com中结束。



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


I'm trying to use google app engine's mail service on my site. It's showing some error whenever I visit the page that sends the email. The error says that I am using an unauthorized sender for the message. Here's the code that sends the email:

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

When I try out the site locally (using dev_appserver.py) it doesn't show the error, but it doesn't send the email (Note: I have to add the --enable_sendmail option when I try it locally). The error only shows up when I publish the site.

Does anybody know what I'm doing wrong? Thanks in advance for your help!

解决方案

What is myapp@appspot.gserviceaccount.com? You might not be able to send mail from that address.

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

这篇关于Google Appengine发送电子邮件:[错误]未经授权的发件人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆