有些电子邮件没有使用播放邮件插件发送

时间:2017-12-11 12:06:35

标签: scala email playframework akka

我在Scala中有一个应用程序,我使用play mailer 6.0.1向大约20-30人发送电子邮件。我在后端使用akka来安排邮件在特定时间(周二恰好是上午10点),并且一个接一个地向大约20-30个人发送邮件。除了1或2之外,几乎所有的邮件都完美无缺。这里是我得到的错误信息:

[error] a.a.OneForOneStrategy - Sending the email to the following server failed : smtp.gmail.com:587
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:587
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
    at org.apache.commons.mail.Email.send(Email.java:1496)
    at play.api.libs.mailer.SMTPMailer$$anon$1.send(SMTPMailer.scala:14)
    at play.api.libs.mailer.CommonsMailer.send(CommonsMailer.scala:21)
    at play.api.libs.mailer.SMTPMailer.send(SMTPMailer.scala:24)
    at play.api.libs.mailer.SMTPDynamicMailer.send(SMTPDynamicMailer.scala:8)
    at actors.EmailActor$$anonfun$receive$1.applyOrElse(EmailActor.scala:36)
    at akka.actor.Actor$class.aroundReceive(Actor.scala:513)
    at actors.EmailActor.aroundReceive(EmailActor.scala:27)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:527)
Caused by: javax.mail.MessagingException: Can't send command to SMTP host
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2324)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2311)
    at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1351)
    at javax.mail.Transport.send0(Transport.java:257)
    at javax.mail.Transport.send(Transport.java:124)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
    at org.apache.commons.mail.Email.send(Email.java:1496)
    at play.api.libs.mailer.SMTPMailer$$anon$1.send(SMTPMailer.scala:14)
    at play.api.libs.mailer.CommonsMailer.send(CommonsMailer.scala:21)
    at play.api.libs.mailer.SMTPMailer.send(SMTPMailer.scala:24)
Caused by: java.net.SocketException: Connection closed by remote host
    at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1555)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71)
    at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:138)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2322)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2311)
    at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1351)
    at javax.mail.Transport.send0(Transport.java:257)
    at javax.mail.Transport.send(Transport.java:124)

我有以下配置:

play.mailer {
  host = "smtp.gmail.com"
  port=587
  ssl=no
  tls=yes
  user = "USERNAME@EMAIL.COM"
  password = "PASSWORD"
  debug = no
  timeout = 60000
  connectiontimeout = 60000
  mock = false
}

对上述错误的任何见解都会非常有帮助。请务必询问您认为必要的任何内容,以便了解上述错误的根源。

0 个答案:

没有答案