下面,我已经粘贴了我的代码发送邮件与附加的文件。我不知道我在代码中遗漏了什么,但我在我的web应用程序中得到了一个
NoSuchElementException
。有人能说出我遗漏了什么吗?或者服务器部件有问题吗?我是否必须在我的代码项目中添加apache或任何服务器许可证。
下面是我的代码:
val email = Email(
"Simple email",
"Mister FROM <vignesh.gopal@hubino.com>",
Seq("Miss TO <ibrahim.sultan@hubino.com>"),
attachments = Seq(
AttachmentFile("leak.txt", new File("E:/oui_mem_leak.txt")),
AttachmentData("data.txt", "data".getBytes, "text/plain", Some("Simple data"), Some(EmailAttachment.INLINE))),
bodyText = Some("A text message"),
bodyHtml = Some("<html><body><p>An <b>html</b> message</p></body></html>")
println("email contents: " + email)
MailerPlugin.send(email)
application.conf
smtp.host = localhost
smtp.port = 9000
smtp.ssl = false
smtp.tls = false
smtp.debug = false
smtp.mock = false
build.sbt
"org.apache.commons" % "commons-email" % "1.3.3",
"com.typesafe.play" %% "play-mailer" % "2.4.1"
例外:
! @6nj6i1d36 - Internal server error, for (GET) [/stores/algo/file/download] ->
play.api.Application$$anon$1: Execution exception[[NoSuchElementException: None
get]]
at play.api.Application$class.handleError(Application.scala:296) ~[play
2.11-2.3.9.jar:2.3.9]
at play.api.DefaultApplication.handleError(Application.scala:402) [play
2.11-2.3.9.jar:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonf
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.9.ja
:2.3.9]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonf
n$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.9.ja
:2.3.9]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.