我使用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)
}
但我收到此错误: {"代码":"失败","消息":"有效'到'需要的电子邮件地址","数据":[]}
答案 0 :(得分: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)
}