如何获取存储的邮件内容(不仅是主题)
问题描述:
我遇到了一个问题,如何从mailgun api获取邮件内容。
我使用mailgun事件API(https://documentation.mailgun.com/user_manual.html#events),我成功地得到事件日志。
像
{
"items": [
{
"tags": [],
"timestamp": 1376325780.160809,
"envelope": {
"sender": "[email protected]",
"transport": ""
},
"event": "accepted",
"campaigns": [],
"user-variables": {},
"flags": {
"is-authenticated": true,
"is-test-mode": false
},
"message": {
"headers": {
"to": "[email protected]",
"message-id": "[email protected]",
"from": "Excited User <[email protected]>",
"subject": "Hello"
},
"attachments": [],
"recipients": [
"[email protected]"
],
"size": 69
},
"recipient": "[email protected]",
"method": "http"
}
],
"paging": {
"next":
"https://api.mailgun.net/v3/samples.mailgun.org/events/W3siY...",
"previous":
"https://api.mailgun.net/v3/samples.mailgun.org/events/Lkawm..."
}
}
返回数据,但问题是,事件日志未包含电子邮件内容(仅须从,到...)。
如何获取电子邮件内容?
有人能给我一个例子吗?
谢谢!
答
mailgun Log API不包含电子邮件内容。
要获取电子邮件内容,您需要注册一个webhook并按照Retrieving Stored Messages示例进行操作。
您还可以根据此blog post通过Events API获取消息。
感谢您的回复。我从这个博客得到了答案。 http://blog.mailgun.com/how-to-view-your-messages/ – timlentse