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

Sending mail by Unauthorised sender in Google AppEngine

我有一个 Google AppEngine Python 应用程序连接到 我的域
我希望能够从任何电子邮件发送电子邮件,例如:mailname@mydomain.com

所以我使用 sendmail() 并设置 mailobject.sender = "sender@mydomain.com",但它不起作用。
我也做了一个接收功能,但是我不想在这里接收邮件,所以我就做了

def receive(self, mail):
    pass

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

我应该在应用程序中添加什么才能发送邮件?

假设 mydomain.com 注册为 Google 域帐户,请尝试在 App Engine 管理控制台的权限部分添加角色为 'Developer' 的 sender@mydomain.com : https://appengine.google.com/permissions?&app_id=s~yourapp(将 yourapp 替换为您的应用 ID)

有关详细信息,请参阅 https://cloud.google.com/appengine/docs/python/mail/sendingmail

来自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. 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).

这意味着没有记录从 *@example.org 发送的方式。我认为如果您的@example.org 是一个 google 应用程序域,但我找不到任何相关文档。