简体   繁体   English

Google Appengine发送电子邮件:[错误]未经授权的发件人

[英]Google Appengine sending emails: [Error] unauthorized sender

I'm trying to use google app engine's mail service on my site. 我正在尝试在我的网站上使用Google App Engine的邮件服务。 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). 当我在本地尝试该站点时(使用dev_appserver.py ),它没有显示错误,但没有发送电子邮件(注意:在本地尝试时,我必须添加--enable_sendmail选项)。 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? 什么是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. App Engine应用程序可以代表应用程序的管理员以及具有Google帐户的用户发送电子邮件。

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. 使用Google帐户登录的当前请求的用户地址。 You can determine the current user's email address with the Users API. 您可以使用Users API确定当前用户的电子邮件地址。 The user's account must be a Gmail account, or be on a domain managed by Google Apps. 该用户的帐户必须是Gmail帐户,或者位于由Google Apps管理的域上。

  • Any valid email receiving address for the app (such as xxx@APP-ID.appspotmail.com). 该应用程序的任何有效电子邮件接收地址(例如xxx@APP-ID.appspotmail.com)。

  • Any valid email receiving address of a domain account, such as support@example.com. 域帐户的任何有效电子邮件接收地址,例如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. 域帐户是Google域之外的帐户,其电子邮件地址不以@ gmail.com或@ APP-ID.appspotmail.com结尾。

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

First follow these steps 首先按照以下步骤

https://cloud.google.com/appengine/docs/python/mail/#who_can_send_mail https://cloud.google.com/appengine/docs/python/mail/#who_can_send_mail

Then you need to manually add the sender email in cloud console 然后,您需要在云控制台中手动添加发件人电子邮件

How to add an authorized sender 如何添加授权发件人

You may also have to add the email address you which to send the email from to the App Engine application settings Email API authorized senders. 您可能还必须将用于发送电子邮件的电子邮件地址添加到App Engine应用程序设置“电子邮件API”授权的发件人。

See https://cloud.google.com/appengine/docs/python/mail/#Python_Sending_mail 请参阅https://cloud.google.com/appengine/docs/python/mail/#Python_Sending_mail

在此处以管理员身份添加未经授权的电子邮件地址: https : //console.developers.google.com/project/_/permissions/projectpermissions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过Google AppEngine中未经授权的发件人发送邮件 - Sending mail by Unauthorised sender in Google AppEngine 由于缺少 api 代理,从 Google Appengine 发送电子邮件失败 - Sending emails from Google Appengine fails because of missing api proxy 谷歌应用引擎未授权状态 401 - google appengine Unauthorized status 401 发送邮件的appengine对于硬编码的电子邮件没有收到任何错误,但是在使用以表单发送的数据时出现了错误 - appengine sending mail getting no error for hardcoded emails, but errors when using the data sent in form Google Appengine不使用DKIM代码签名电子邮件 - Google Appengine not signing emails with DKIM code 谷歌appengine中的BeautifulSoup错误 - BeautifulSoup error in google appengine 使用Google AppEngine在Python中对电子邮件发件人进行单元测试和模拟 - Unit testing and mocking email sender in Python with Google AppEngine InvalidSenderError:未经授权的发件人-GAE-域不受Google Apps管理 - InvalidSenderError: Unauthorized sender - GAE - domain not managed by google apps 在Google AppEngine上使用urllib2导致服务器错误 - Server error with using urllib2 on Google AppEngine 将多张票发送到有限的电子邮件时出错 - Error sending multiple tickets to limited emails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM