简体   繁体   English

通过Google AppEngine中未经授权的发件人发送邮件

[英]Sending mail by Unauthorised sender in Google AppEngine

I've got a Google AppEngine Python application connected with my domain . 我已经将一个Google AppEngine Python应用程序连接到我的域
I want to be able to send emails from any email, like: mailname@ mydomain.com 我希望能够从任何电子邮件发送电子邮件,例如: mailname @ mydomain.com

So I use sendmail() and set mailobject.sender = "sender@mydomain.com", but it does not work. 所以我使用sendmail()并设置mailobject.sender =“ sender@mydomain.com”,但是它不起作用。
Also I made a receive function, but I don't want to receive mails here, so I just made 我也做了一个接收功能,但是我不想在这里接收邮件,所以我做了

def receive(self, mail):
    pass

In Google Documentation https://cloud.google.com/appengine/docs/python/mail/receivingmail : 在Google文档https://cloud.google.com/appengine/docs/python/mail/receivingmail中

  • 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结尾。

What should I add to the application in order to be able to send mails? 我应该在应用程序中添加什么才能发送邮件?

From https://cloud.google.com/appengine/docs/python/mail/emailmessagefields 来自https://cloud.google.com/appengine/docs/python/mail/emailmessagefields

sender 发件人

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)。

This means that there is no documented way to send from *@example.org. 这意味着没有从*@example.org发送的书面记录。 I thought that there was a way if your @example.org was a google apps domain but I cannot find any docs on that. 我以为如果您的@ example.org是Google Apps域是一种方法,但是我找不到关于它的任何文档。

Assuming mydomain.com is registered as a Google Domain Account, try adding sender@mydomain.com with the role 'Developer' in the Permissions section of the App Engine Admin Console: https://appengine.google.com/permissions?&app_id=s~yourapp (replace yourapp with your app's ID) 假设mydomain.com已注册为Google Domain帐户,请尝试在App Engine管理控制台的“权限”部分中添加具有“开发人员”角色的sender@mydomain.com: https ://appengine.google.com/permissions?&app_id = s〜yourapp (用您的应用程序ID替换yourapp)

For more information see https://cloud.google.com/appengine/docs/python/mail/sendingmail 有关更多信息,请参见https://cloud.google.com/appengine/docs/python/mail/sendingmail

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM