假设我有用户在我的 GAE 应用程序中注册了他们用来访问 GMail、日历、联系人等的 Google 帐户。他们确认我的应用程序可以从他们的 GMail 帐户发送电子邮件,并且当他们单击某个链接时,例如“向我所有的 friend 发送通知”,该消息会从用户的 GMail 帐户发送到其应发送的位置。是否可以在不要求用户与我的应用程序共享其登录名和密码的情况下完成此操作?
最佳答案
来自 GAE Mail API文档:
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.
- Any valid email receiving address for the app (such as xxx@APP-ID.appspotmail.com).
因此,如果他们使用 Users API 登录您的应用,您只需将发件人
设置为与用户帐户关联的电子邮件地址即可:
message.sender = users.get_current_user().email()
关于python - 从登录我的 GAE 应用程序的用户发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5836036/