0

这是课程 -

    implicit def stringToSeq(single: String): Seq[String] = Seq(single)
  implicit def liftToOption[T](t: T): Option[T] = Some(t)

    sealed abstract class MailType
  case object Plain extends MailType
  case object Rich extends MailType
  case object MultiPart extends MailType

  case class Mail(from: (String, String), // (email, name)
                  to: Seq[String],
                  cc: Seq[String] = Seq.empty,
                  bcc: Seq[String] = Seq.empty,
                  subject: String,
                  message: String,
                  richMessage: Option[String] = None,
                  attachment: Option[(java.io.File)] = None
                  )

这就是我如何使用它们 -

new Mail (
                      from = ("xxx.@abc.com", "Shwetanka"),
                      to = opts(0),
                      subject = "Test Email",
                      message = "",
                      richMessage = htmlMsg(opts(1)).toString()
                    )

我收到编译错误 -

    /home/shwetanka/projects/scala/tools/src/main/scala/Mailer.scala:32: not enough arguments for constructor Mail: (from: (String, String), to: Seq[String], cc: Seq[String], bcc: Seq[String], subject: String, message: String, richMessage: Option[String], attachment: Option[java.io.File])email.package.Mail
[error]                         send a new Mail (
[error]                                ^
[error] one error found
[error] (compile:compile) Compilation failed

我无法弄清楚为什么它没有编译。我正在使用 sbt 并通过“运行”命令运行它。

4

0 回答 0