Skip to content

Add a suppression bypass header for custom confirmation emails

What does this MR do and why?

This adds a X-Mailgun-Suppressions-Bypass: true header to the verification_instructions_email and confirmation_instructions_email emails in order to bypass Mailgun Suppressions.

Issue: https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/126

How to set up and validate locally

In Rails console, you can send an email and inspect the log:

> Notify.verification_instructions_email('my@email', token: 123456).deliver_now
Notify#verification_instructions_email: processed outbound mail in 50.9ms
Delivered mail 63625d0c81caf_50bd39bc21892@Alex-MacBook-Pro.local.mail (9.3ms)
Date: Wed, 02 Nov 2022 13:05:32 +0100
From: GitLab <example@example.com>
Reply-To: GitLab <noreply@example.com>
To: my@email
Message-ID: <63625d0c81caf_50bd39bc21892@Alex-MacBook-Pro.local.mail>
Subject: Verify your identity
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_63625d0c7bd1a_50bd39bc21716";
 charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Mailgun-Suppressions-Bypass: true
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

and

> Notify.confirmation_instructions_email('my@email', token: 123456).deliver_now
Notify#confirmation_instructions_email: processed outbound mail in 27.9ms
Delivered mail 63625c963a9ca_50bd39bc21237@Alex-MacBook-Pro.local.mail (8.4ms)
Date: Wed, 02 Nov 2022 13:03:34 +0100
From: GitLab <example@example.com>
Reply-To: GitLab <noreply@example.com>
To: my@email
Message-ID: <63625c963a9ca_50bd39bc21237@Alex-MacBook-Pro.local.mail>
Subject: Confirm your email address
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_63625c9636489_50bd39bc21169";
 charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Mailgun-Suppressions-Bypass: true
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
...

A local preview (without headers) of the emails can be seen here:

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alex Buijs

Merge request reports