1

我正在使用 SendInBlue Java Api 发送电子邮件,我在 Scala 中编写了这段代码:

object SendInBlueApi extends App{
  val http : Sendinblue= new Sendinblue("https://api.sendinblue.com/v2.0","API_KEY");
  var data: Map[String, Any]= Map[String, Any]()
  data += ("to" -> "test1@gmail.com")
  data += ("from" -> "test2@gmail.com")
  data += ("subject" -> "My subject")
  data += ("text" -> "This is text")
  val str = http.send_email(data)
  println(str.toString)
}

但我收到此错误: {"code":"failure","message":"valid 'to' email address required","data":[]}

4

1 回答 1

0

这是在地图中添加元素的另一种方式:

object SendInBlueApi extends App{
  val http : Sendinblue= new Sendinblue("https://api.sendinblue.com/v2.0","API_KEY");
  var data: Map[String, Any] = Map[String, Any](
    data("to") -> "test1@gmail.com",
    data("from") -> "test2@gmail.com",
    data("subject") -> "My subject",
    data("text") -> "This is text"
  )
        println(str.toString)
}
于 2017-06-05T14:30:49.397 回答