lundi 31 décembre 2018

Get subject of opened or clicked email in Mailgun

I've set up my Mailgun domain to track the opens and clicks of emails sent by my Laravel app.

Now I want to set up webhooks to be notified of those events.

In particular, I'd love to know the event type (e.g. open, click, failed, etc), subject, recipient email address, and ideally the body of the message (although not necessary). For 'click' events, I also want to see the URL of the link that was clicked.

I see which fields of Event data get sent by the webhook, and unlike Amazon SES, Mailgun's webhooks do not seem to include the email subject or body.

The webhook provides data like this:

"message": {
    "headers": {
        "message-id": "f9bxxxxx1e30e7278f5fe75f50741fb3@swift.generated"
    }
}

So it seems to me that I'd somehow need to go to every place within my app that sends an email and add extra functionality to save to my own database the details of the email along with the unique Mailgun message-id of every message right after it has been sent.

Then, when receiving webhooks, I'd search my own database for the message-id and could see the subject and body that I'd stored.

This seems like a terrible hassle and poor design, especially given that other services (such as SES) would provide the email subject for me in the webhook.

Is there some easier way for me to know which emails were opened or clicked (when I receive a Mailgun webhook about an open or click event)?

(Am I misunderstanding something, or would I really need to revamp my entire app to take advantage of open tracking in Mailgun?)



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2SpAuEm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire