Thursday, February 5, 2015

Send Email thru Office 365: Client does not support from this sender

com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.60 SMTP; Client does not have permissions to send as this sender at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2110) at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:1889) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1120) at javax.mail.Transport.send0(Transport.java:189) at javax.mail.Transport.send(Transport.java:118)..

This site has a very good explanation with the error.

How to Send email from Office 365 in your application

Cause:
The Mail Address set as the SMTP server does not have the permission to send email on behalf of other mail addresses.
Resolution:
  1. Make sure that the 
  2. Do not send test email with any other mail address except for the SMTP server mail address in the From field

Your set up of email properties should be like this
  mail.smtp.host=smtp.office365.com   
  mail.smtp.port=587   
  mail.smtp.starttls.enable=true   
  mail.smtp.auth=true   
  mail.smtp.ssl.trust=smtp.office365.com   
  mail.user=noreply@mycompany.com  //your From address should be the same of the username set here  
  mail.password=Password123$   

1 comment:

  1. Am getting the same error after applying all these changes in jenkins.

    ReplyDelete