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を使用しており、これを「run」コマンドで実行しています。

4

0 に答える 0