Send a bulk email
1. Prepare the content
First you'll need to get access to the subject and the body of the email. The format for the subject is plain text and for the body it is a limited subset of markdown.
Note that the final email won't include any subscription information, so that should be included in the body of the email itself. An example could be:
You’re getting this email because you subscribed to updates from Travel Advice on GOV.UK. [View, unsubscribe or change the frequency of your subscriptions](https://www.gov.uk/email/manage)
2. Get the subscriber lists
Next you'll need to get the IDs of all the subscriber lists to send the email
out to. This will require querying the email-alert-api
For example, to get the IDs of all the subscriber lists for travel advice, you could use the following query:
> SubscriberList.where("links->'countries' IS NOT NULL").pluck(:id)
3. Send a test email
Once you've got the content and the subscriber lists for the email, you can use staging to send out a test email. First make sure that you have subscribed to one of the subscriber lists and then use the Send bulk emails job in staging to send the email.
Make sure you are able to receive emails in staging.
4. Send the real email
If the test email works and looks good, it's time to send the real email! You can copy the parameters used in staging and run the same job in production.
5. Monitor the queues
It may be useful to monitor the Sidekiq queues of email-alert-api to
look at the progress of the email and estimate how long it will take. Note that
the emails from the bulk task end up on the
default queue meaning that they
are the lowest priority of email.
At the time of writing, an email to all travel advice subscribers (~560,000 subscribers) takes around 4-5 hours to send to everyone.