Skip to main content

Send an email to all GOV.UK Account users

Sometimes you may need to email all GOV.UK Account users. For example, after a request from the Senior Management Team (SMT).

Send an email

  1. Sign in to production.

    If you are already signed in to CloudFoundry:

    cf target -s production
    

    If you are not already signed in to CloudFoundry:

    cf login -a api.london.cloud.service.gov.uk --sso -o govuk-accounts -s production
    
  2. SSH into a production machine:

    cf ssh govuk-account-manager
    
  3. Load the application environment:

    $ /tmp/lifecycle/shell
    
  4. Open a Ruby on Rails console:

    $ rails c
    
  5. Assign the email subject and content to variables:

    subject = "<email-subject-line>"
    body = "<email-body-text>"
    

    For example:

    subject = "Important changes to your GOV.UK Account"
    body = "You must perform an action"
    
  6. Trigger an email to all account users:

    User.all.each do |user|
      UserMailer.with(email: user.email, subject: subject, body: body).adhoc_email.deliver_later
    end
    
  7. Check the emails have begun to appear in the GOV.UK Notify dashboard.

This page was last reviewed on 23 December 2020. It needs to be reviewed again on 23 June 2021 .
This page was set to be reviewed before 23 June 2021. This might mean the content is out of date.