playframework / playframework/play-mailer
Can't configure office365 SMTP on play mailer 5.0.0-M1
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 252
- Forks
- 73
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 19
Description
I recently tried this plug in.. and was able to send mails using google smtp.. Now in the same application I'm trying to integrate my office365 mailbox and send emails out. for that I followed this
application.conf:
play.mailer {
host = smtp.office365.com
port = 587
ssl = no
tls = yes
username = "hiren.***@*****.com"
password = "******"
debug = no
timeout = 600
connectiontimeout = 600
mock = no
}
but throws an exception:
[error] application - Email Sending Exception :
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1421)
at org.apache.commons.mail.Email.send(Email.java:1448)
at play.api.libs.mailer.SMTPMailer$$anon$2.send(MailerPlugin.scala:100)
at play.api.libs.mailer.CommonsMailer.send(MailerPlugin.scala:130)
at play.api.libs.mailer.SMTPMailer.send(MailerPlugin.scala:110)
at play.api.libs.mailer.SMTPDynamicMailer.send(MailerPlugin.scala:117)
at play.api.libs.mailer.MailerClient$class.send(MailerPlugin.scala:56)
at play.api.libs.mailer.SMTPDynamicMailer.send(MailerPlugin.scala:114)
at controllers.EmailHelper.sendEmail(EmailHelper.java:17)
at controllers.HomeController.addUser(HomeController.java:61)
Caused by: javax.mail.AuthenticationFailedException:
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:887)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:814)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:728)
at javax.mail.Service.connect(Service.java:386)
at javax.mail.Service.connect(Service.java:245)
at javax.mail.Service.connect(Service.java:194)
at javax.mail.Transport.send0(Transport.java:253)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
at org.apache.commons.mail.Email.send(Email.java:1448)
Caused by: javax.mail.MessagingException: Exception reading response
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2304)
at com.sun.mail.smtp.SMTPTransport.simpleCommand(SMTPTransport.java:2234)
at com.sun.mail.smtp.SMTPTransport$LoginAuthenticator.doAuth(SMTPTransport.java:928)
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:870)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:814)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:728)
at javax.mail.Service.connect(Service.java:386)
at javax.mail.Service.connect(Service.java:245)
at javax.mail.Service.connect(Service.java:194)
at javax.mail.Transport.send0(Transport.java:253)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:124)
The problem I could suspect is tls version which should be >=1.0 for office365. But don't know how to check it.
I tried hard to find solution but couldn't.
any hint will be helpful.. thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SMTP configuration in application.conf and the send and connection paths shown in MailerPlugin.scala, then reproduce the Office365 connection using the supplied host, port, TLS, and timeout settings. Compare the resulting JavaMail authentication and socket-timeout behavior with the working Google SMTP setup; done means identifying whether Office365 SMTP can be configured successfully or documenting the limitation and required settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100