2
在Mandrill API上通过Jersey客户端发送消息时遇到问题。我使用Jersey客户端如下:发送请求的Mandrill API错误
ClientBuilder.newClient()
.register(JacksonJsonProvider.class)
.target(“https://mandrillapp.com/api/1.0/messages/send.json”)
.request(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.json(methodEntity));
您可以在下面看到日志标头,API请求的方法和内容。
POST https://mandrillapp.com/api/1.0/messages/send.json
Accept: application/json
Content-Type: application/json
{"message":{"subject":"Hello World!","text":"Really, Im just saying hi from Mandrill!","to":[{"email":"[email protected]","name":"Marcel cccc","type":"to"}],"headers":{},"tags":["test"],"from_email":"[email protected]","auto_text":true,"preserve_recipients":false},"async":false,"key":"EWIBVEIOVBVOIEBWIOVEB"}
为响应这一请求,我不断收到以下消息:
[{"email":"[email protected]","status":"rejected","_id":"0ea5e40fc2f3413ba85b765acdc5f17a","reject_reason":"invalid-sender"}]
我不知道问题是什么,从一些帖子中,我想通了,我必须使用UTF-8编码我消息和标题。但是将编码设置为UTF-8并没有太大的好处。否则,有效载荷对我来说似乎很好,而且我在论坛上发现无效的发件人可能意味着任何其他类型的问题(不仅仅是无效的发件人是悲伤的)。
谢谢!这真的有帮助,我不希望这个问题可能与用户代理头 – 2014-10-01 13:15:10