Tutorial :Google App Engine Java Send Mail from alternate email Address


Is there a way to change the From email address to another email address in google app engine. Right now I want to send from addresses in my domain that is linked to google app engine, not the email address or the main address. ie: my account address is XXX@gmail.com but I want the email to come from no-reply@mydomain.com.



Here the documentation

Here is the relevant section:

Message msg = new MimeMessage(session);  msg.setFrom(new InternetAddress("admin@example.com", "Example.com Admin"));  

A little farther down it states a caveat:

To set the sender address, the app calls the setFrom() method on the MimeMessage object. The sender must be either the address of a registered developer for the application, or the address of the user for the current request signed in with a Google Account.

So you just have to register no-reply@mydomain.com as a developer on your application. This means no-reply@mydomain.com must be a valid email at the time of registration. I am not sure if you can just delete it after registration or not. You can always set up mail rules to delete all email that comes to that account if you want but the directions for that will be mail provider specific.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »