【发布时间】:2016-11-16 06:11:02
【问题描述】:
我正在尝试使用 mandrill 电子邮件服务发送电子邮件,但收到以下错误:
[
{
"email": "pranav_withyou@hotmail.com",
"status": "rejected",
"_id": "daab0daa538a4fe9b161be709593be0b",
"reject_reason": "unsigned"
}
]
我正在尝试在 javascript 中使用 ajax 调用发送电子邮件,例如:
$.ajax({
type: "POST",
url: "https://mandrillapp.com/api/1.0/messages/send.json",
data: {
"key": "RemovedforSecurityitscorrect",
"message": {
"html": "<p>Example HTML content</p>",
"text": $('#emailText').val(),
"subject": $('#emailSubject').val(),
"from_email": $('#fromEmail').val(),
"from_name": $('#fromName').val(),
"to": [{
"email": $('#toEmail').val(),
"name": $('#recipientName').val(),
"type": "to"
}],
"headers": {
"Reply-To": $('#fromName').val()
}
},
success: function (data) {
console.log("Email Sent");
},
error: function (xhr, status, error) {
console.log("Error while sending mail");
}
}
});
所有值都来自 ajax 调用,并且从响应中可以明显看出对服务器的调用。有什么问题?
【问题讨论】:
标签: javascript ajax email mandrill