【发布时间】:2019-02-13 17:45:37
【问题描述】:
根据documentation,我可以收到一封带有错误消息的信,以防发送问题,例如模板表达式损坏的情况。 根据我的要求,我添加了所有必要的字段:
"TemplateErrorReporting": {
"Email": "recipient@gmail.com",
"Name": "recipient name"
}
我在模板中添加了一个错误并通过 API 发送信件:
client = new MailjetClient(mj_apikey_public, System.getenv("MJ_APIKEY_PRIVATE"), new ClientOptions("v3.1"));
request = new MailjetRequest(Emailv31.resource)
.property(Emailv31.MESSAGES, new JSONArray()
.put(new JSONObject()
.put(Emailv31.Message.FROM, new JSONObject()
.put("Email", "service@test.test")
.put("Name", "Mailjet error handling testing"))
.put(Emailv31.Message.TO, new JSONArray()
.put(new JSONObject()
.put("Email", "dmytro.parkhomenko@test.test")
.put("Name", "passenger 1")))
.put(Emailv31.Message.TEMPLATEID, 66638587)
.put(Emailv31.Message.TEMPLATELANGUAGE, true)
.put(Emailv31.Message.SUBJECT, "Mailjet error handling testing subject")
.put(Emailv31.Message.TEMPLATEERROR_DELIVERY, false)
.put(Emailv31.Message.TEMPLATEERROR_REPORTING, new JSONObject()
.put("Email", "recipient@gmail.com")
.put("Name", "recipient name"))));
response = client.post(request);
因此,我没有按预期收到来自 template-language-error@mailjet.com 的信函,因此模板错误管理对我不起作用。
【问题讨论】: