开发者

How do I send an email from a non-gmail account using the appengine

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 au开发者_如何学Pythonthorize 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜