Send confirmation emails with a copy of answers using SES#2124
Send confirmation emails with a copy of answers using SES#2124stephencdaly wants to merge 11 commits into
Conversation
9a2cd03 to
fcffab6
Compare
2512ffd to
5eb6b4d
Compare
| @@ -0,0 +1,29 @@ | |||
| class AwsSesSubmissionConfirmationMailer < ApplicationMailer | |||
There was a problem hiding this comment.
Nit: do we need to say "AwsSes" in the class name - there's nothing in this class implementation that's specific to AWS SES
There was a problem hiding this comment.
I know we do so with other mailer names - but really is irrelevant.
There was a problem hiding this comment.
I've created a card for using SES for all confirmation emails and added a task to remove the prefixes when we're no longer sending using Notify too https://trello.com/c/GfBTJbNL/3581-use-ses-to-send-all-confirmation-emails
Initially, we will just send confirmation emails with a copy of the user's answers using SES, but we should switch to using it for all confirmation emails when we're confident that it works as expected. The mailer accepts a `include_copy_of_answers` parameter to allow for sending confirmation emails without a copy of the user's answers. The `_content` partials exist because we repeat the same content in English and Welsh if the form was filled out using Welsh.
Allow specifying the heading level for the answer content in the formatter so we can use h4 for the confirmation email.
5eb6b4d to
cd7fe6f
Compare
Construct the question/answer section in the Welsh part of the confirmation email using the question text from the Welsh form document saved on the submission.
We don't attach the uploaded file for file upload questions to the confirmation email with a copy of the answers, and so want to display different content. We also want to display the filename that the user uploaded the file with, rather than the filename with the submission reference and any suffix that we send in the submission email to form processors.
We now store the Welsh form document on the submission for forms that have a submission_locale of "cy". We no longer need to retrieve the form document from forms-admin when sending the confirmation email and can instead read it from the submission.
Accept an include_copy_of_answers parameter to SendConfirmationEmailJob. If this is set to true, use SES to send the confirmation email, including the answer in the email. In future we'll use SES to send all confirmation emails, but we want to make sure this is working correctly just for emails that include a copy of the answers first.
If the user has asked to receive a copy of their answers, enqueue the confirmation email job using the email address stored on the session after they logged in the GOV.UK One Login, and with include_copy_of_answers set to true.
ActiveJob sets the locale for jobs to be the locale at the time of enqueuing. Force the job to use the English locale, as we send multilingual emails if the user submitted answers in Welsh.
Using the module constant is preferred over using a symbol
cd7fe6f to
338e459
Compare
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2124.submit.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
What problem does this pull request solve?
Trello card: https://trello.com/c/hCWhyMOm
Send a confirmation email using Amazon SES containing a copy of the user's answers if they have signed in with One Login and asked for a copy of their answers.
If they have not asked for a copy of their answers, continue sending the confirmation email using Notify. However, the mailer for sending with SES accepts an option for including a copy of the answers or not, so switching over down the line to use SES for all confirmation emails should be easy.
Email styling
We're not currently explicitly specifying the style for headings, as per the submission email. We probably should, especially as we're now introducing h4s. I'd welcome comments on the best way to do this - but might raise a follow up PR to look at this as this PR is already very big.
Testing
You'll need to configure your GOV.UK One Login test service (ask me how if you haven't)
Then run locally, in an AWS shell for the dev-readonly role with the following environment variables:
Things to consider when reviewing