Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Following the introduction of email interception in integration and staging environments (see PR #7240).
- Loading branch information
1 parent
4c6e92c
commit 8abbeb1
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Email delivery | ||
|
||
Whitehall sends various kinds of [email notifications](https://github.com/alphagov/whitehall/blob/ad86a5ea8d7538f787c71cb586adb1b771ea08d9/app/mailers/mail_notifications.rb) to users – for example, fact check requests and responses. These emails are delivered via [GOV.UK Notify](https://www.notifications.service.gov.uk/) using the [mail-notify](https://github.com/dxw/mail-notify) gem. | ||
|
||
## Non-production environments | ||
|
||
Emails sent from Whitehall's integration and staging environments are not delivered to end users. | ||
|
||
Instead, they're [intercepted and re-routed](https://github.com/alphagov/whitehall/pull/7240) to a Google Group (shared mailbox) so they can be accessed for debugging purposes. The intended recipient is prepended to the email body so it's easy to see who it would've been delivered to. | ||
|
||
👉 [See emails from integration](https://groups.google.com/a/digital.cabinet-office.gov.uk/g/whitehall-emails-integration) | ||
|
||
👉 [See emails from staging](https://groups.google.com/a/digital.cabinet-office.gov.uk/g/whitehall-emails-staging) | ||
|
||
## Send a test email from the Rails console | ||
|
||
> **⚠️ Warning** | ||
> | ||
> Running this in **production** will send an email to the specified recipient. | ||
> Use **integration or staging** if you want the email to be intercepted. | ||
To send a test email, open a Rails console and run: | ||
|
||
```ruby | ||
ApplicationMailer.new.mail( | ||
subject: "Test email", | ||
to: "recipient@example.com", | ||
body: "This is a test email", | ||
template_id: ENV.fetch("GOVUK_NOTIFY_TEMPLATE_ID", "fake-test-template-id") | ||
).deliver | ||
``` |