我正在使用MailJet Java Api发送电子邮件,我将此代码编写为scala:
object Main {
var client: MailjetClient = null
var request: MailjetRequest = _
var response: MailjetResponse = _
def main(args: Array[String]) {
client = new MailjetClient(System.getenv("MJ_APIKEY_PUBLIC"), System.getenv("MJ_APIKEY_PRIVATE"))
request = new MailjetRequest(Email.resource)
.property(Email.FROMEMAIL, "pilot@mailjet.com")
.property(Email.FROMNAME, "Pilot")
.property(Email.SUBJECT, "Your mail !!!!")
.property(Email.TO, "passenger@mailjet.com")
response = client.post(request)
println(response.getStatus)
println(response.getData)
}
但是我得到401 Unauthorized
,虽然我的公共API密钥和私有都是更正的。你有任何想法