Search code examples
emailmandrillemail-headers

Add custom metadata when sending an email using mandrill and receive metadata in an inbound event


i will like to know if there is a way to add custom metadata when sending an email using the mandrill API (/messages/send.json) and receive this metadata in an inbound event. I know that there is a way as it's explained here https://mandrill.zendesk.com/hc/en-us/articles/205582417-Using-Custom-Message-Metadata; but i am afraid this metadata will not be included in inbound emails, only in message events

Is it possible to receive custom metadata (or custom fields) in inbound emails?

Thanks


Solution

  • I also mislead this things first time I read docs about Mandrill events ^_^ Message Events represent actual inbound mails. Mandrill receives SMTP mail and sends HTTP request with JSON representation (+ additional info from service) of such event (type: inbound) to yours webhook. Inbound Events represent events that occurred with outbound mails. Mandrill sends HTTP request with JSON representation (+ additional info from service) of such event (type: sent, bounced, rejected, etc) to yours webhook.

    No, it's not possible to send metadata with inbound event as far you only receive such events. You may only receive metadata back in message event.

    https://mandrill.zendesk.com/hc/en-us/articles/205582417-Using-Custom-Message-Metadata

    Mandrill allows you to attach custom, individualized metadata to messages. Use custom metadata to integrate your application's data model with Mandrill. Metadata is searchable (either in the activity view or via the API) and is included with webhook events and activity CSV exports.

    But if you want to get back some info in reply to your outbound mail, you may pass some custom header, e.g. X-My-Own-Metadata: 42, and expect all intermediates (including Mandrill) will not cut it during transmission.