Mailgun:是否有一种方法可以检索一个存储的邮件呼叫放弃的存储消息



我有一个通过以下方式设置传入路线的Mailgun应用程序:

match_recipient('me@example.com')
store(notify='https://www.example.com/endpoint')

在某个时候,我将域从www.example.com切换为www.example2.com,并通过301重定向DNS提供商(读:我无法访问日志..)而不更改MailGun路由。

在几天的时间里

现在,我想尝试检索这些存储的消息,但是在那里我找不到进入原始ID的方法。

这是Mailgun事件日志中存储的内容:

{
  "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成功方案中,发布到服务器的消息包含一个回调url来检索看起来像这样的消息:

https://api.mailgun.net/v2/domains/www.example.com/messages/WyI4MzNheDUxMmRjIiwgWyI0ZWFiNWM1Mi05Zjg4LTRkMjctYjdhMS04ZTM3Y2E3ZDJmNTkiXSwgIm1haWxndW4iLCAib2xkY29rZSJd

这是以下几个base64编码消息(所有UID均已修改):

["833ax512dc", ["4eab5c52-9f88-4d27-b7a1-8e37ca7d2f59"], "mailgun", "oldcoke"]

是否有一种方法可以使用消息ID构建存储消息检索URL 20150430214155.10820.14949?

这对于阿米塔的需求来说可能太晚了,但是如果其他人想知道一种获取该检索URL的方法,我的方法是使用事件API:

get/events?message-id = {您的消息ID}

这将返回响应,其中包含"项目"密钥下的结果列表。这些项目将在"存储"密钥下使用该URL,为" URL"。

因此,如果response是该呼叫的响应,则第一个响应的URL将在response['items'][0]['storage']['url']上找到。

我希望能帮助某人!

最新更新