文件没有使用播放框架播放邮件插件附加

时间:2017-05-15 21:20:05

标签: java scala playframework-2.0 akka email-attachments

我们使用以下插件在Play应用程序中发送电子邮件。发送电子邮件部分完全正常,但是当我添加附件时,我遇到了以下错误,表明该文件不存在。虽然我100%确定我的磁盘上存在该文件,但后来它也在代码中通过了我的vaidation测试

在代码中添加附件

email.addAttachment(fileName,new File ("path"))

https://github.com/playframework/play-mailer

错误堆栈:

    2017-05-15 20:37:15,870 [ERROR] from application in application-akka.actor.default-dispatcher-10 - org.apache.commons.mail.EmailException: Cannot attach file "/tmp/playtemp7007305302758557514/multipartBody5483238492998817693asTemporaryFile"
    at org.apache.commons.mail.MultiPartEmail.attach(MultiPartEmail.java:334)
    at play.api.libs.mailer.CommonsMailer.play$api$libs$mailer$CommonsMailer$$handleAttachmentFile(MailerPlugin.scala:251)
    at play.api.libs.mailer.CommonsMailer$$anonfun$createEmail$10.apply(MailerPlugin.scala:150)
    at play.api.libs.mailer.CommonsMailer$$anonfun$createEmail$10.apply(MailerPlugin.scala:146)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at play.api.libs.mailer.CommonsMailer.createEmail(MailerPlugin.scala:146)
    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)

0 个答案:

没有答案