如何使用appengine从非Gmail帐户发送电子邮件 [英] How do I send an email from a non-gmail account using the appengine

查看:148
本文介绍了如何使用appengine从非Gmail帐户发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Google App Engine成功发送了一封电子邮件。但是,我唯一可以上网的电子邮件地址是我作为网站管理员列出的gmail地址。我正在自己的域上运行该应用(使用Google Apps进行购买和维护)。我想从我自己的域发送电子邮件。以下是代码(或类似的代码):

  from google.appengine.api import mail 

sender =myaddress@google.com
sender_i_want =myaddress@mygoogleapp.com

mail.send_mail(sender = sender,
to =Albert Johnson< Albert.Johnson@example.com>,
subject =您的帐户已被批准,
body = some_string_variable)

当我尝试从我自己的域发送它时,我得到的错误是InvalidSenderError:Unauthorized sender。我拥有域名,实际上我使用我的域来发送邮件,我只需要知道如何说服App Engine这是真的。

解决方案

这是限制 App Engine的邮件API


发件人地址可以是应用程序的注册管理员的电子邮件地址,也可以是当前登录的用户(正在发送消息的请求的用户)。


如果您的Google Apps正在运行该域名,您应该拥有(或能够创建)@ thatdomain.com电子邮件地址,您可以注册为有关的App Engine应用程序的管理员,然后可以从该地址发送电子邮件。 p>

I have successfully sent an email using the Google App Engine. However the only email address I can get to work is the gmail address I have listed as the admin of the site. I'm running the app on my own domain (bought and maintained using Google Apps). I would like to send the email from my own domain. Here's the code (or something similar to it):

from google.appengine.api import mail

sender = "myaddress@google.com"
sender_i_want = "myaddress@mygoogleapp.com"

mail.send_mail(sender=sender,
    to="Albert Johnson <Albert.Johnson@example.com>",
    subject="Your account has been approved",
    body=some_string_variable)

And the error I get when I try to send it from my own domain is "InvalidSenderError: Unauthorized sender". I own the domain, I do in fact authorize using my domain to send the mail, I just need to know how to convince the App Engine that this is true.

解决方案

That's a restriction of App Engine's mail API:

The sender address can be either the email address of a registered administrator for the application, or the email address of the current signed-in user (the user making the request that is sending the message).

If you've got Google Apps running on that domain, you should have (or be able to create) an @thatdomain.com email addresses that you can register as an administrator of the App Engine app in question, which will then let you send email "from" that address.

这篇关于如何使用appengine从非Gmail帐户发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆