Search code examples
google-app-enginejakarta-mailsendmailtransport

Is there a way to change from address/email id on email sent from Google App engine Mail


Is there a way to change "from address" or email-id on email sent from Google App engine Code ? I am able to change the reply-to address but send-from mail address is only taking Administrator email id. Is there an application setting through which i can change the sent from email id ?

    Message msg = new MimeMessage(session11);
      msg.setFrom(new InternetAddress(Constants.DB.Connection.ADMINEMAIL, "TEST MAIL"));

      msg.addRecipient(Message.RecipientType.TO, new InternetAddress(useremail, " TEST MAIL"));

      msg.setReplyTo(new javax.mail.Address[]

                    {
                        new javax.mail.internet.InternetAddress(" testemail@xyz.com")
                    }); 

                  msg.setSubject(subject);
                  msg.setContent(message,"text/html");
                  Transport.send(msg);

Any suggestion or help would be appreciated


Solution

  • Yes, you can change the sender. But, that email must be listed as an administrator (developer). Your app can have more than one administrator.