Reputation: 434
Is there a way in Google App Engine (Java) to get the the email address of the admin that is allowed to send mails without hardcoding it somewhere?
Currently I use the Java System property in the appengine-web.xml. Something like the uploader of the app would be fine, too.
Background of this question: I create an app that students have to clone in their own GAE instance. Hence the cloning effort should be minimized as much as possible.
Upvotes: 0
Views: 336
Reputation: 130
The format of the sending e-mail address seems to have changed (as of 2016) and so I would use:
msg.setFrom(new InternetAddress(SystemProperty.applicationId.get() + "@appspot.gserviceaccount.com"));
Upvotes: 0
Reputation: 3859
I believe what you are looking for is the way to figure out the email id that is valid to send out mail from. You can figure out the appid dynamically using the App Identity API and construct the sender email id dynamically.
https://cloud.google.com/appengine/docs/java/appidentity/
Once you have the appid you can construct the email id as [email protected] where 'string' can be anything and 'appid' is the appid you got from the Identity API.
Upvotes: 2