我有一个邮件枪应用程序,通过以下方式设置了传入路由:
match_recipient('me@example.com')
store(notify='https://www.example.com/endpoint')在某一时刻,我通过域名服务提供商将域名从www.example.com切换到www.example2.com,重定向301 (阅读:我无法访问日志。)而不改变邮件枪的路线。
在几天的时间里,我在日志中得到了一堆永久性的错误,因为webhook似乎不遵循重定向。
现在,我想尝试检索这些存储的消息,但我找不到获取原始ID的方法。
以下是存储在邮件枪事件日志中的内容:
{
"severity": "permanent",
"tags": [],
"delivery-status": {
"retry-seconds": 14400,
"message": "<html><body>You are being <a href=\"https://www.example2.com/endpoint\">redirected</a>.</body></html>",
"code": 301,
"description": "<html><body>You are being <a href=\"https://www.example2.com/endpoint\">redirected</a>.</body></html>",
"session-seconds": 0.7563347816467285
},
"envelope": {
"targets": "https://www.example.com/endpoint",
"transport": "http",
"sender": "postmaster@example.com"
},
"log-level": "error",
"id": "dffZ3qigQpyKGNdwhfj26A",
"campaigns": [],
"reason": "old",
"user-variables": {},
"flags": {
"is-routed": null,
"is-authenticated": true,
"is-callback": true,
"is-system-test": false,
"is-test-mode": false
},
"timestamp": 1430473028.303534,
"message": {
"headers": {
"to": null,
"message-id": "20150430214155.10820.14949@example.com",
"from": "postmaster@example.com",
"subject": null
},
"attachments": [],
"recipients": [
"https://example.com/endpoint"
],
"size": 47467
},
"recipient": "https://example.com/endpoint",
"event": "failed"
}(1)在上面的内容中,id似乎代表了事件ID,我认为这是无关紧要的,而消息ID似乎是20150430214155.10820.14949。
(2)在典型的webhook成功场景中,发布到服务器的消息包含一个callback-URL,用于检索如下所示的消息:
https://api.mailgun.net/v2/domains/www.example.com/messages/WyI4MzNheDUxMmRjIiwgWyI0ZWFiNWM1Mi05Zjg4LTRkMjctYjdhMS04ZTM3Y2E3ZDJmNTkiXSwgIm1haWxndW4iLCAib2xkY29rZSJd这是以下内容的Base64编码消息(所有UID都已修改):
["833ax512dc", ["4eab5c52-9f88-4d27-b7a1-8e37ca7d2f59"], "mailgun", "oldcoke"]有没有办法使用消息ID 20150430214155.10820.14949构造存储消息检索URL?
发布于 2016-04-05 07:44:13
对于AmitA的需求来说,这可能有点晚了,但如果其他人想知道获取检索URL的方法,我的方法是使用Events API:
GET /events? message -ID={您的消息ID}
这将返回一个响应,并在“items”键下显示结果列表。这些项目将在“storage”键下具有该URL,即“url”。
因此,如果response是GET调用的响应,则可以在response['items'][0]['storage']['url']中找到第一个响应的URL。
我希望这对外面的人有帮助!
https://stackoverflow.com/questions/30017420
复制相似问题