简体   繁体   中英

AppEngine Email : Unauthorized Sender

When I try to send mail I get a "Unauthorized sender" exception

javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Illegal Arguments (java.lang.IllegalArgumentException: Unauthorized Sender: Unauthorized sender)) at javax.mail.Transport.send(Transport.java:163) at javax.mail.Transport.send(Transport.java:48)

My code to send mail is very simple:

Session session = Session.getDefaultInstance(new Properties(), null);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("admingae@tecurti.com", "Adming"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("name@gmail.com", "Felipe"));
msg.setSubject("Assunto", "UTF-8");
msg.setText("texto corpo");
Transport.send(msg);

I´ve already give to admingae@tecurti.com "owner" permission on admin console.

Here is my App Engine Console permission

If anyone could help me I appreciated

thanks


Solutions Thanks to Andrei Volgin I will register the solution

Admin Console Correct Register

In console go to App Engine > Settings > Application Settings. Add this email address to the list of authorized senders.

Today this is little different and requires more setup for security reasons.

The zero configuration way, is sending email from an email address with this format:

[anything]@[project_id].appspotmail.com

FYI: https://cloud.google.com/appengine/docs/standard/java/mail/#who_can_send_mail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM