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("[email protected]", "Adming"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]", "Felipe"));
msg.setSubject("Assunto", "UTF-8");
msg.setText("texto corpo");
Transport.send(msg);
I´ve already give to [email protected] "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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With