I am having trouble sending email from my app at Google App Engine. I am experiencing several newbee hurdles and I would appreciate your help.
I take this function from the tutorial and for the "sender" field I put my gmail account that I used to create the app:
mail.send_mail(sender="owners_email_acco...#gmail.com",
to="xxxx...#gmail.com",
subject="test email from app",
body="hello")
when I try this, I get the error:
InvalidSenderError: Unauthorized sender
But the email
sender="owners_email_acco...#gmail.com",
is the email I use to log into the app; this is the email I used to create the app.
The tutorial says:
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.
So the email I used to create the app should work as a sender. What am I doing wrong? Thanks.
(I asked the same question in GAE group but there was no reply)
I read that aliases and nicknames through google apps won't be recognised as their underlying address so maybe that's the problem.
I approached this just a few days ago and after making sure all sender addresses were listed in the 'permissions' section of the application console, it all worked fine.
Related
I'm trying to send an email using the java api. I've got my app running live, no custom domain, in fact it's just a default project. Billing is not enabled. My app name is 'testapp'.
I'm using this email address for the sender:
admin#testapp.appspotmail.com
That seems to be ok if I'm reading the docs correctly (criteria #2):
For security purposes, the sender address of a message must be one of the following:
The Gmail or Google Apps Account of the user who is currently signed in
Any email address of the form anything#appname.appspotmail.com or anything#appalias.appspotmail.com
Any email address listed in the Cloud Platform Console under Email API Authorized Senders
The email was sent successfully twice, but now it has stopped working (same sender address, same recipient address). Nothing appears in the recipient's spam.
I can see in the quota page that the # of emails-sent keeps incrementing. But nothing is actually going through.
What am I missing?
Thanks
This is a known issue that is currently being tracked on the App Engine public issue tracker. Please feel free to star this issue for updates.
Here's the situation: I have successfully set up email to come from a custom domain on App Engine before, but that was always done through the Google Apps for Business set up process. This time I have added the custom domain through the new developers console instead (https://console.developers.google.com/project/[APP_ID]/appengine/settings/domains) and now I'm getting the "unauthorized sender" error every time.
I've tried a lot of variations on the set up process, checked for typos or other potential bugs repeatedly, and scoured both the docs and Stack Overflow without finding an answer. Most of the docs and answers that come up seem woefully out of date. The docs hardly ever reference the new developer console or the fact that Google Apps for Business doesn't have a free tier any more. And most of the answers seem to ignore the fact that the docs (https://cloud.google.com/appengine/docs/python/mail/sendingmail) explicitly state that "Domain accounts do not need to be explicitly verified, since you will have verified the domain during the registration process."
So has anyone actually gotten domain accounts to work with the new process? Do I have to modify DNS records? DKIM? Something else I'm missing? Any insight would be much appreciated.
As stated in the docs:
For security purposes, the sender address of a message must be the
email address of an administrator for the application or any valid
email receiving address for the app (see Receiving Mail). The sender
can also be the Google Account email address of the current user who
is signed in, if the user's account is a Gmail account or is on a
domain managed by Google Apps.
So only logged in Google accounts or admin (owners in the new console) addresses can be used to send emails through GAE. If you want to use a set of custom domain addresses you can either:
1) Add and validate all those addresses as owners in the project's "permissions" settings.
2) Use as external party to send your emails through a Web API, EG Sendgrid which gives you 25.000 emails/month for free for GAE developers (https://cloud.google.com/appengine/docs/python/mail/sendgrid)
What I have done:
I have added my domain app.mydomain.com to my app engine project, and can successfully visit id.appspot.com using app.mydomain.com.
I have registered mydomain.com on google app for business.
The problem:
The problem is -- I am NOT able to send emails using #mydomain.com address. If I register an info#mydomain.com as an developer, this will probably solve the problem, but we need to send from more than one address, and I don't think registering a new developer for each address is reasonable.
Anybody knows how to solve this? Thanks!
You have two options:
Register all emails that you want to use as administrators/developers but as you mentioned in your post you don't want to do that.
Use SendGrid (or any other email services like Mandrill, Mailgun, etc.) which will give you a lot more features comparing to what GAE offers, including 25k free emails instead of GAE's 100.
According to the docs, the sender would need to be an administrator on the project (called "owner" in the new Developers Console). Another route would be to just use a separate email sending service like SendGrid or Postmark.
You can use the GMail API to send emails as users of your domain. Note that the emails need to be aliases, groups or users of your domain.
You shouldn't have any problem adding and verifying your domain, adding the necessary permissions to send emails. Then, every email address in your domain can be used. See here in the docs: https://developers.google.com/appengine/docs/java/mail/#Java_Sending_mail
As part of my App Engine application, I decided to configure an already-purchased custom domain name that would point to the app. To do this, I was directed to use Google's Apps for Business product.
Unfortunately, verification of the custom domain went bad, which was a surprise, because Google contacted my domain registrar directly. A week passed, and the domain was still listed as undergoing verification.
Is there a way I can restart the process, and hopefully complete it by a different method?
Have a look at this page:
http://support.google.com/a/bin/answer.py?answer=96917
Click on the first radio button ("I'm receiving the message 'This domain is already in use.'")
Toward the bottom of the page, there will be a URL template:
https://www.google.com/a/cpanel/<your domain name>/VerifyAdminAccountPasswordReset
Sign into your Google Apps account, then substitute your domain name in the above URL-template where indicated.
When you visit the resulting URL, Google will ask you for an email address. You will then get an email supplying data values for a new CNAME record you can add at your domain-registrar's website. If you do that correctly, Google will then consider your custom domain as verified.
my application deployed on app engine has been working succesfully half a year. One function is a sending of emails. But today it started to fail everytime with this error:
javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Illegal Arguments (java.lang.IllegalArgumentException: Unauthorized Sender: Unauthorized sender))
Of course sender email is registered in app engine console.
I didn't change anything!
Anyone who share same issue?
If someone have the same problem, the reason is the sender for the mail is incorrect or doesn't have permissions to send the email, I use the default noreply#your-application-id.appspot.com account to send the email.
InternetAddress from = new InternetAddress(
String.format("noreply#%s.appspotmail.com", SystemProperty.applicationId.get()),
"Your Application Name") ;
message.setFrom(from);
You can check if the account of your user is not marked as a spammer or disabled in Google Apps.
If you are sending a very large number of emails to a single email account, Google can throttle you. When we were sending emails whenever we got an error, we ran into a similar problem.
Also, there is a limit on number of calls to mail API per minute.
Maybe earlier you were sending mail to fewer people resulting in fewer calls to the mail api.
It's 8 calls per minute, unless you have provided a credit card number to enable your billing.
Does your sender email address has permission to access this app engine application ?
it's must have permission to access your application then it will work...