Skip to content

Commit

Permalink
Use Notify template in mailer layout
Browse files Browse the repository at this point in the history
Adds the default Notify template markup (taken from https://github.com/alphagov/notifications-utils/blob/e89dcc53c7f88ef23053d1efb2c00b8ef2ea377e/notifications_utils/jinja_templates/email_template.jinja2)
to the mailer.html.erb file. This will wrap the SES email content in the
same markup we currently get from Notify, so the GOV.UK branding will be
present and consistent with other emails.

At present, we don't send any other emails using this mailer layout.
  • Loading branch information
DavidBiddle committed Feb 10, 2025
1 parent 10d70b4 commit 65b1ed3
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 5 deletions.
154 changes: 149 additions & 5 deletions app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,157 @@
<!-- BEGIN app/views/layouts/mailer.html.erb -->

<!DOCTYPE html>
<html>
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="telephone=no" name="format-detection"> <!-- need to add formatting for real phone numbers -->
<meta name="viewport" content="width=device-width">
<title>{{ subject }}</title>

<style>
/* Email styles need to be inline */
@media only screen and (min-device-width: 581px) {
.content {
width: 580px !important;
}
}
body { margin:0 !important; }
div[style*="margin: 16px 0"] { margin:0 !important; }
</style>

<!--[if gte mso 9]>
<style>
li {
margin-left: 4px !important;
}
table {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
</style>
<![endif]-->

</head>

<body>
<%= yield %>
<body style="font-family: Helvetica, Arial, sans-serif;font-size: 16px;margin: 0;color:#0b0c0c;">
<table role="presentation" width="100%" style="border-collapse: collapse;min-width: 100%;width: 100% !important;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100%" height="53" bgcolor="#0b0c0c">
<!--[if (gte mso 9)|(IE)]>
<table role="presentation" width="580" align="center" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;width: 580px;">
<tr>
<td>
<![endif]-->
<table role="presentation" width="100%" style="border-collapse: collapse;max-width: 580px;" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="70" bgcolor="#0b0c0c" valign="middle">
<a href="https://www.gov.uk" title="Go to the GOV.UK homepage" style="text-decoration: none;">
<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;">
<tr>
<td style="padding-left: 10px">
<img src="https://static.notifications.service.gov.uk/images/govuk-logotype-tudor-crown.png"
alt=""
height="32"
border="0"
style="Margin-top: 2px;"
>
</td>
<td style="font-size: 28px; line-height: 1.315789474; Margin-top: 4px; padding-left: 8px;">
<span style="
font-family: Helvetica, Arial, sans-serif;
font-weight: 700;
color: #ffffff;
text-decoration: none;
vertical-align:middle;
display: inline-block;
">GOV.UK</span>
</td>
</tr>
</table>
</a>
</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
<table
role="presentation"
class="content"
align="center"
cellpadding="0"
cellspacing="0"
border="0"
style="border-collapse: collapse;max-width: 580px; width: 100% !important;"
width="100%"
>
<tr>
<td width="10" height="10" valign="middle"></td>
<td>
<!--[if (gte mso 9)|(IE)]>
<table role="presentation" width="560" align="center" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;width: 560px;">
<tr>
<td height="10">
<![endif]-->
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;">
<tr>
<td bgcolor="#1D70B8" width="100%" height="10"></td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
<td width="10" valign="middle" height="10"></td>
</tr>
</table>
<table
role="presentation"
class="content"
align="center"
cellpadding="0"
cellspacing="0"
border="0"
style="border-collapse: collapse;max-width: 580px; width: 100% !important;"
width="100%"
>
<tr>
<td height="30"><br>
</td>
</tr>
<tr>
<td width="10" valign="middle"><br>
</td>
<td style="font-family: Helvetica, Arial, sans-serif; font-size: 19px; line-height: 1.315789474; max-width: 560px;">
<!--[if (gte mso 9)|(IE)]>
<table role="presentation" width="560" align="center" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse;width: 560px;">
<tr>
<td style="font-family: Helvetica, Arial, sans-serif; font-size: 19px; line-height: 1.315789474;">
<![endif]-->

<%= yield %>

<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
<td width="10" valign="middle"><br>
</td>
</tr>
<tr>
<td height="30"><br>
</td>
</tr>
</table>
</body>
</html>
<!-- END app/views/layouts/mailer.html.erb -->
4 changes: 4 additions & 0 deletions spec/mailers/aws_ses_form_submission_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
expect(mail.subject).to eq("Form submission: #{title} - reference: #{submission_reference}")
end

it "has a link to GOV.UK" do
expect(mail.body).to have_link("GOV.UK", href: "https://www.gov.uk")
end

it "includes the answers" do
expect(mail.body).to match(answer_content)
end
Expand Down

0 comments on commit 65b1ed3

Please sign in to comment.