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