feat: disable mailjet open and click tracking
This commit is contained in:
1 parent
8898320e21
commit
2ef831c5c4
2 files changed
+72
No files matched your search
@@ -19,6 +19,9 @@ class Mailer
|
||||
* reminders: Mailjet (MAILING_MAILER_DSN, mailer.yaml), rather than the webhoster's relay that
|
||||
* carries every other mail, which would risk the hosting account at a few hundred mails. Pass
|
||||
* it as the 'transport' option.
|
||||
*
|
||||
* Mail sent over it is never tracked, whatever the Mailjet account is set to: no open pixel,
|
||||
* no links rewritten through Mailjet's redirect domain. Staff mail is not a campaign.
|
||||
*/
|
||||
public const string MAILJET_TRANSPORT = 'mailing';
|
||||
|
||||
@@ -83,6 +86,16 @@ class Mailer
|
||||
$email->getHeaders()->addTextHeader('X-Transport', $config['transport']);
|
||||
}
|
||||
|
||||
// Mailjet tracks per its account settings unless a message says otherwise. These headers
|
||||
// only work over SMTP (mailjet+smtp, the DSN we use) - the Send API refuses them - and
|
||||
// Symfony's SMTP transport passes them through untouched.
|
||||
if (self::MAILJET_TRANSPORT === $config['transport']) {
|
||||
$email->getHeaders()
|
||||
->addTextHeader('X-Mailjet-TrackOpen', '0')
|
||||
->addTextHeader('X-Mailjet-TrackClick', '0')
|
||||
;
|
||||
}
|
||||
|
||||
if (null !== $config['bus_transport']) {
|
||||
$email->getHeaders()->addTextHeader('X-Bus-Transport', $config['bus_transport']);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user