0
votes

SendGrid can track when the emails are opened:

enter image description here

How to get a notification (via email) when emails are opened, for which the recipient is different to [email protected]? (I don't want to receive a notification when I open my own emails sent to myself as BCC).

Do I need to use the SendgridAPI? How? Can I ask Sendgrid to send a notification? (To my server, who will send the notification? To something else?)

1

1 Answers

0
votes

The solution is to go in Dashboard > Settings > Mail settings > Event notification.

enter image description here

Then here is a possible eventlistener.php:

<?php

$postdata = json_decode(file_get_contents("php://input"));

foreach ($postdata as $event) 
{
    if (($event->event === 'open') && ($event->email !== '[email protected]'))
    {
        mail('[email protected]', 'Mail to ' . $event->email . ' opened', 'Opened.', "From: [email protected]");
    }
}

?>