dqzuo0327 2015-02-18 20:03
浏览 69
已采纳

Mandrill API - 获取电子邮件的所有收件人

I've been working with the Mandrill API for sending transactional email for a while.

I want to use the API to display inside of a web application the total stats for an email (an "email" being one message sent to multiple recipients) being. (recipients, bounces, opens, clicks).

The problem is that Mandrill sends back an ID for each message sent. So if I sent an email to 100 people, I would get 100 message IDs. It would be extremely expensive to look up each of those messages, get each message's bounce, opens and clicks and sum them together.

I have read the documentation over and over and cannot seem to find a way to get all the information from one "email". Mandrill treats an email to 100 people as 100 emails, but I see it as one email to 100 people.

Is there a less expensive way to gather this information?

Is there a convoluted way to do it using metadata?

  • 写回答

1条回答 默认 最新

  • dongshi3605 2015-02-19 17:16
    关注

    You're correct - Mandrill treats each email recipient as a single email. Opens, clicks, bounces, and other activity are tracked individually for each recipient, and in order to do that, an individual, specific email must be sent to each recipient. While you're sending the same content to each recipient, tracking on a per-recipient basis necessarily requires that an individual email be created for each recipient.

    You have a few options - regardless, you probably want to use webhooks to have open, click, etc. data passed back to you rather than looking up that data each and every time you want to display information about messages. Webhooks would allow you to get the data, add to your counts, and cache that data unless/until there are additional opens/clicks to record. Without adding any metadata, you can use that unique message id for a series of recipients or a specific "message" from your system to increment your counters.

    If you wanted to, you could also use a custom metadata field in Mandrill, to pass some unique identifier when you send a message to associate these 100 emails/recipients with a single message in your system. Metadata is stored/tracked for 30 days, and is included in webhooks, as well, so you can reference back to your system in that way, too.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?