使用SendGrid模块通过Parse云代码发送大型电子邮件似乎存在问题。某些消息不会发送并返回400错误。
{"Cache-Control":"no-cache","Connection":"close",
"Content-Type":"text/html","Date":"Wed, 13 Aug 2014 03:21:13 GMT",
"Server":"nginx/1.4.7"},"text":"<html><body><h1>400 Bad request</h1>
\nYour browser sent an invalid request.\n</body></html>\n"
当我减少我发送的html字符串的大小时,它可以毫无困难地工作。关于Sendgrid for Parse的文档很少甚至没有。
以下是我发送电子邮件的代码。我发送的html字符串大约是4300个字符。
var hostEmail = host.attributes.user.attributes.email;
var subject = visitorFullName + " is here to see you";
var html = '@@html-email text goes here';
SendGrid.sendEmail({
to: hostEmail,
from: "no-reply@example.co",
subject: subject,
html: html
}, {
success: function(httpResponse) {
response.success('email sent');
},
error: function(httpResponse) {
response.error(httpResponse);
}
});
有没有办法让这个长字符串工作?谢谢!