如何代表 yahoo、hotmail 或 .edu 用户在 GAE 中发送电子邮件?

发布于 2024-11-05 17:52:20 字数 1118 浏览 0 评论 0原文

在 GAE 上,非 Gmail 用户可以使用其非 Gmail 电子邮件创建 Google 帐户并登录 Google App Engine 应用程序。然而,从该电子邮件发送似乎并不总是有效。

例如,假设[email protected]创建了一个 Google 帐户并且他们登录然后,GAE 应该能够从 [电子邮件受保护] 在用户请求期间。

问题是这似乎不适用于雅虎电子邮件帐户和其他帐户。根据我的经验,只有以下用户可以代表他们发送电子邮件:

  • 当前登录的 gmail 用户
  • 当前登录的用户使用 在 Google 应用程序上运行的电子邮件
  • 管理员

但是,您无法代表具有以下电子邮件地址的用户发送电子邮件:

  • yahoo 和 hotmail 用户
  • .gov 或 .mil 用户
  • 大多数 .edu 用户,尽管我认为有些学校使用 Google 应用并且它们可以工作。

如果我从这些电子邮件地址发送邮件,我会收到以下错误:

   message.send();
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/mail.py", line 799, in send
    raise ERROR_MAP[e.application_error](e.error_detail)
InvalidSenderError: Unauthorized sender

我在这里遗漏了什么吗?

我知道关于这个话题也有类似的问题,但我认为他们没有解决这些问题。

On GAE, a non-gmail user can create a Google Account using their non-gmail email and log into a google app engine application. However, sending from that email does not appear to work all the time.

For example, suppose [email protected] creates a google account and they log in. Then, GAE should be able to send email from [email protected] during a user request.

The problem is that this does not appear to work for yahoo email accounts and others. In my experience, only the following users can have email sent on their behalf:

  • Currently logged in gmail users
  • Currently logged in users with emails that run on google apps
  • Administrators

However, you cannot send email on behalf of users with the following email address:

  • yahoo and hotmail users
  • .gov or .mil users
  • most .edu users, although I think some schools use google apps and they work.

If I send from those email addresses, I get the following error:

   message.send();
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/mail.py", line 799, in send
    raise ERROR_MAP[e.application_error](e.error_detail)
InvalidSenderError: Unauthorized sender

Am I missing something here?

I know there are similar questions out there on this topic but I don't think they nail them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟花肆意 2024-11-12 17:52:20

您的应用程序无权从不属于您的地址发送电子邮件。

这样做被称为欺骗,在过去 8 年里已经做了很多工作来防止欺骗:DKIM、SPF...

如果您需要发送电子邮件,您需要有自己的电子邮件地址/域来发送此应用程序的电子邮件,您还需要处理退回邮件。


更新:

Google 帐户

Google 帐户可以使用第3 方域电子邮件地址(例如hotmail、yahoo、*.edu 等)创建。会有一个电子邮件确认步骤来验证电子邮件地址,但可能没有比这更大的关系了。电子邮件地址是“用户名”,并且有一个由 Google 创建的密码,与第 3 方域无关。

Google 帐户不必具有邮件服务组件。您可以创建一个 Google 帐户,但没有 Gmail。

第三方域上的 Google 电子邮件

Google Apps 可以“在”第三方域上运行,这可以但不一定包括 Google 电子邮件。

谷歌电子邮件可以在任何域上运行,无需任何其他“应用程序”,他们提供电子邮件外包,这对教育行业非常有吸引力。在这种情况下,Google 对该域的电子邮件具有权威。

代表邮寄

Google 电子邮件具有设置“代表”电子邮件的功能。这需要配置。确认电子邮件将发送到目标帐户。创建后,电子邮件将使用邮件信封中的原始帐户的电子邮件地址发送,因此任何递送状态消息(延迟、拒绝)都将返回到该帐户。原始电子邮件地址也将出现在发件人标头中。您代表发送的地址将显示在邮件的发件人标头中,但除此之外,就安全设置和验证而言,它是来自 Google 的 Google 电子邮件。

快速搜索后发现一些科技博客网站表明他们正在考虑停用此功能,转而支持第三方 SMTP 服务。

第三方 SMTP 服务器

因此,有人可以使用其邮件服务提供商的 SMTP 服务器、用户名和密码配置其 Google 电子邮件帐户,并使用它通过其邮件服务提供商的有效服务器通过其 Google 邮件界面发送电子邮件。因此,这封电子邮件将真正“源自”该域的基础设施。


我还没有阅读此 GAE 功能发送电子邮件的文档。但是,我可以看到,如果某人登录了他们的 Google 帐户,并且该帐户有邮件服务,那么就可以使用 API 从该帐户发送电子邮件。

但是,Google 不会生成“来自”未获得授权的第三方域的电子邮件。该电子邮件无效;它将被“欺骗”。它可能不符合各种安全增强措施,可能被恶意使用,并使它们名誉扫地。

我希望这能让你更清楚地了解情况。

如果文档缺乏这方面的内容,那么编写该文档的人可能会因为对电子邮件如此熟悉而很难想象有人会认为这是可能的。

Your application has no right to originate email from addresses you don't own.

Doing so is called spoofing and there has been a lot of work done in the last 8 years to prevent spoofing: DKIM, SPF...

If you need to send email you need to have your own email address(es)/domain to send the email from for this application and you'll need to handle bounces as well.


Update:

Google Accounts

Google accounts can be created using 3rd party domain email addresses (e.g. hotmail, yahoo, *.edu, etc). There will be an email confirmation step to verify the email address, but there may be no greater relationship than this. The email address is the "username" and there's a password created with Google that has nothing to do with the 3rd party domain.

Google accounts don't have to have a mail service component. You can create a Google account and not have Gmail.

Google email on a 3rd party domain

Google Apps can be run "on" 3rd party domains, this can, but not necessarily include Google email.

Google email could be run on any domain without any other "Apps", they offer email outsourcing which is quite attractive to the Education sector. In this scenario, Google is authoritative for email for that domain.

On behalf of mailing

Google email has the functionality to set up "On Behalf of" emailing. This requires configuration. A confirmation email is sent to the target account. Once created the email is sent using the originating account's email address in the mail envelope, so any delivery status messages (delays, rejections) will be returned to this account. The originating email address will also be in the sender header. The address that you're sending on behalf of will appear in the from header in the messages, but otherwise, with regards to security settings and validation, it's a Google email from Google.

A quick search has returned some tech blog websites that suggest that they are considering retiring this feature in favour of supporting third party SMTP services.

Third party SMTP server

So someone could configure their Google Email account with the SMTP server, username and password of their mail service provider and use it to send email via their Google mail interface through the valid servers of their mail service provider. This email would therefore genuinely "originate" from that domain's infrastructure.


I've not read the documentation for this GAE function to send email. However, I can see that if someone is signed into their Google account and that account has a mail service, then it could be possible to send email from that account using an API.

However, Google will not generate email "From" 3rd party domains for which it has not been assigned authority over. The email would not be valid; it would be "spoofed". It may not comply with a variety of security enhancements, could be used maliciously and would bring them into disrepute.

I hope this makes the situation clearer for you.

If the documentation is lacking in this regard, it could be that those who wrote it, being so familiar with email, might find it hard to imagine someone would think it were possible.

小姐丶请自重 2024-11-12 17:52:20

对我来说,谷歌似乎改变了一些东西。我有一个应用程序运行了 1.5 年,没有出现任何问题(和更改),但突然在 2011 年 5 月 3 日代表雅虎用户发送电子邮件时停止工作。

这一变化还影响了其他非 Google(非开发者用户)。

For me it looks like Google has changed something. I've had an application running 1,5 years without problems (and changes) but suddenly on 2011-05-03 sending emails for example on behalf of Yahoo users stopped working.

This change also affected other non-Google (non-developer users).

罗罗贝儿 2024-11-12 17:52:20

如果[email protected]创建一个 Google 帐户并登录,您将能够代表其 Gmail 用户发送,但不能代表其 Yahoo 用户发送。 Hotmail 也一样。至于 .gov、.mil 或 .edu,这些 TLD 没有什么特别之处。如果它们是 Google Apps 域,您可以从它们发送,否则不能。

但请注意,您可以指定回复地址发送邮件时。这可以是任何电子邮件地址,因此如果您使用的回复地址为 [email] protected] 出站邮件,收件人点击回复,这应该是地址被填充为收件人。

If [email protected] creates a Google account and logs in, you will be able to send on behalf of their Gmail user, but not their Yahoo user. Same for Hotmail. As for .gov, .mil or .edu, there's nothing special about these TLDs. If they are Google Apps domains, you can send from them, otherwise you cannot.

Note, though, that you can specify a Reply-To address when sending mail. This can be any email address whatsoever, so if you use a reply-to address of [email protected] on outbound mail and the recipient clicks reply, this should be the address that's populated as the recipient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文