feat: disable mailjet tracking on every mail
This commit is contained in:
1 parent
2ef831c5c4
commit
d760ed3cdf
6 files changed
+31
-33
No files matched your search
@@ -24,7 +24,8 @@ use Psr\Log\LoggerInterface;
|
||||
* confirmation would need machinery nothing else here has.
|
||||
*
|
||||
* Goes over MAILER_DSN like every transactional mail; MAILING_MAILER_DSN is for mail sent in
|
||||
* volume, the teamer mailing and the cron reminders (Mailer::MAILJET_TRANSPORT).
|
||||
* volume, the teamer mailing and the cron reminders (Mailer::MAILJET_TRANSPORT). Production
|
||||
* points both at Mailjet.
|
||||
*/
|
||||
class ApplicationFormSubmissionMailer
|
||||
{
|
||||
|
||||
+14
-14
@@ -16,12 +16,12 @@ class Mailer
|
||||
{
|
||||
/**
|
||||
* The mailer transport for mail sent in volume - the teamer mailing and the nightly cron
|
||||
* 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.
|
||||
* reminders: Mailjet (MAILING_MAILER_DSN, mailer.yaml). Pass it as the 'transport' option;
|
||||
* every other mail goes over MAILER_DSN.
|
||||
*
|
||||
* 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.
|
||||
* Production points both DSNs at the same Mailjet account, so today the split changes
|
||||
* nothing there. It keeps the volume mail on Mailjet should the low-volume mail ever move to
|
||||
* another SMTP server.
|
||||
*/
|
||||
public const string MAILJET_TRANSPORT = 'mailing';
|
||||
|
||||
@@ -86,15 +86,15 @@ 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')
|
||||
;
|
||||
}
|
||||
// No mail is 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. On every mail,
|
||||
// not just the volume transport, because production sends all of it over Mailjet; another
|
||||
// SMTP server would merely pass the headers on. They only work over SMTP (mailjet+smtp, the
|
||||
// DSN we use) - the Send API refuses them - and Symfony's SMTP transport leaves them alone.
|
||||
$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']);
|
||||
|
||||
@@ -29,8 +29,7 @@ class TeamerMailingService
|
||||
private const PREVIEW_SUBJECT_PREFIX = '[Vorschau] ';
|
||||
|
||||
/**
|
||||
* The mailer transport a mailing goes out over: Mailjet, rather than the webhoster's
|
||||
* relay, see Mailer::MAILJET_TRANSPORT.
|
||||
* The mailer transport for mail sent in volume, see Mailer::MAILJET_TRANSPORT.
|
||||
*/
|
||||
private const TRANSPORT = Mailer::MAILJET_TRANSPORT;
|
||||
|
||||
|
||||
Reference in new issue
Block a user