Reputation: 20991
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 = "[email protected]"
sender_i_want = "[email protected]"
mail.send_mail(sender=sender,
to="Albert Johnson <[email protected]>",
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.
Upvotes: 4
Views: 1144
Reputation: 13117
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.
Upvotes: 7