How to send email from noreply#mydomain.com with GAE? - google-app-engine

mydomain.com is Google Apps linked to my GAE application (and verified). Currently only one user is allowed at custom domains, so I've registered admin#mydomain.com. Now, I would like to send emails from noreply#mydomain.com. I try to add this user as Developer in Permissions section of my GAE application, it sends the message (which I actually receive at admin#mydomain.com), I accept the invitation as admin#mydomain.com, but it doesn't help.
So, how to send emails from noreply#mydomain.com?

You can enable the trial (lasts for 30 days) and add as many users as you want. You can send emails to them to accept the invitations in GAE and after accepting them you can delete these users to fall back in the free version with only one user.

I have not been able to test the below, as I don't have the new single account Google Apps.
It all depends on if you still want the admin#domain.com user. If not I suggest the following;
For safety link a non-domain email as an owner to your App Engine application
Rename your current Google Apps user from admin to noreply
You should be able to send emails as noreply#domain.com.
If you still want admin#domain.com, maybe you can create an alias for the noreply account?

Related

Gmail API supports a UserID param but how do I setup a Google account with access to multiple mailboxes?

I have an application which needs access to mailboxes for an organization but likely only needs access to the mailboxes for the sales teams and not the mailboxes for the rest of the organization.
For Office 365 we create a service account and get it delegated access to each of the mailboxes it needs to read emails from.
It seems like the Gmail API supports a "userID" parameter.
How can I configure a service account user thru the Admin portal to have access to multiple mailboxes?
Unfortunately this is not possible because a service account acts on behalf of a user who runs the script and does not have the authorization to access other mailboxes.
As a workaround, in the Admin console, the administrator of the domain is able to set up the routing settings for Gmail in a such a way that a copy of all emails addressed to the Sales Team (Organization Unit “Sales Team”) will be delivered to an additional recipient - who will run the API.
When you set-up the routing settings as explained here and add a recipient to whom to deliver a copy of the messages, you can use the option “Advanced”, which allows you to decide to for example to forward attachments or Spam messages as you can see in the image below.
Furthermore, if you don’t want to forward all messages, you can set-up content compliance rules for the inbox of the additional recipient to whom a copy of the messages will be delivered.

How do I send email from a domain account when the domain was added using the NEW console on App Engine?

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)

send email on Google App Engine from custom domain

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

java googlemail blocks multiple access

I need to allow a user of my App to email themselves when an even occurs. I am not sure how to do this.
My first idea is to create a dummy gmail account, and have my App sign-in and send from there via java code. This means hardcoding the password BUT as account not used for anything other than one way emailing - it does not seem to be a problem.
However, I understand that google is pretty proactive about security and if my App (which is global) tries to log into same account in several different countries during a 24 hour period - it will block the email.
I have seen the "delegate" functionality, but that would mean that each user needs their own gmail account which is not practical.
Is there a way to force gmail to allow the sign-ins to happen from wherever?
Or is there a better approach to this problem?
probably not a good idea to have your app to mail from a private account, if I understand you correctly. Best to use email service like http://expresspigeon.com or http://sendgrid.com and simply send a transactional email from your app account. In other words, use an ESP.
The safest would be to ask the user for all the configuration information necessary to access their email server as themself, then send the email as themself to themself. You can use JavaMail to send the message, but you'll need to ask for all the configuration information that any other email application would ask for in order to configure access to their mail server.
There may also be Android-specific ways to do this using the default email application.

How do I send email from Google App Engine with a random sender?

How do I send email from Google App Engine with a random, non-app admin sender using a custom domain name (e.g. xyz#myshop.com ) ? We need to allow the users of our website to communicate with each other through a custom made messaging system but also allow them to reply directly from their email. Something similar with the craigslist system. However seems that GAE doesn't allow us to send email from an address that is not admin. Is there any workaround / patch ? We are the owner of myshop.com domain name (verified through google apps) so I don't see why a such thing is not allowed.
While you can't use just any random address, you can use a registered administrator address with a '+' suffix. So you could send the mail with a 'from' of, say, message-reply+HASH_VALUE#myshop.com. Then your app will receive the reply, and can use the hash to decide which user to forward the mail to.
How about sending the email from your admin account, but adding a reply-to header, specifying the user's email-address?
Google doesn't allow to use random addresses. You can star this bug.
http://code.google.com/p/googleappengine/issues/detail?id=3069
However, since the users are apparently registered with Google Apps, the system can send emails on their behalf when they are signed into your application.
The sender address must be one of the following types:
...
The address of the user for the current request signed in with a
Google Account. You can determine the current user's email address
with the Users API. The user's account must be a Gmail account, or be
on a domain managed by Google Apps.
http://code.google.com/appengine/docs/python/mail/emailmessagefields.html

Resources