feat: disable mailjet tracking on every mail

This commit is contained in:
fromme committed 2026-11-10 17:31:02 +01:00
1 parent 2ef831c5c4
commit d760ed3cdf
6 files changed
+31 -33

No files matched your search

+9 -14
View File
@@ -14,28 +14,23 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class MailerTest extends KernelTestCase
{
/**
* Mailjet would otherwise track opens and rewrite links if the account is set to, which staff
* mail - mailings and reminders alike - must not be.
* Mailjet would otherwise track opens and rewrite links if the account is set to. Production
* sends every mail over Mailjet, whichever transport it names, so none may be tracked.
*/
public function testMailOverMailjetIsNotTracked(): void
#[\PHPUnit\Framework\Attributes\TestWith([Mailer::MAILJET_TRANSPORT])]
#[\PHPUnit\Framework\Attributes\TestWith([null])]
public function testNoMailIsTracked(?string $transport): void
{
$headers = $this->create(Mailer::MAILJET_TRANSPORT)->getHeaders();
$headers = $this->create($transport)->getHeaders();
$this->assertSame(Mailer::MAILJET_TRANSPORT, $headers->get('X-Transport')?->getBodyAsString());
$this->assertSame('0', $headers->get('X-Mailjet-TrackOpen')?->getBodyAsString());
$this->assertSame('0', $headers->get('X-Mailjet-TrackClick')?->getBodyAsString());
}
/**
* The webhoster's relay would pass Mailjet headers on to the recipient as noise.
*/
public function testMailOverTheRelayCarriesNoMailjetHeaders(): void
public function testOnlyTheVolumeMailNamesItsTransport(): void
{
$headers = $this->create(null)->getHeaders();
$this->assertFalse($headers->has('X-Transport'));
$this->assertFalse($headers->has('X-Mailjet-TrackOpen'));
$this->assertFalse($headers->has('X-Mailjet-TrackClick'));
$this->assertSame(Mailer::MAILJET_TRANSPORT, $this->create(Mailer::MAILJET_TRANSPORT)->getHeaders()->get('X-Transport')?->getBodyAsString());
$this->assertFalse($this->create(null)->getHeaders()->has('X-Transport'));
}
/**