Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPP-3901: update content for disable-mask email #5109

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 71 additions & 32 deletions emails/templates/emails/disabled_mask_for_spam.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,71 @@
{% comment %}
Note that Django only loads strings from some Fluent files.
See privaterelay/ftl_bundles.py.
{% endcomment %}
{% load ftl %}
{% load email_extras %}
{% withftl bundle='privaterelay.ftl_bundles.main' language=language %}

{% include "emails/direct_email_header.html" %}

<table role="presentation" border="0" cellpadding="0" cellspacing="10px" style="padding: 60px 30px 120px 30px;" align="center">
<tr>
<td style="max-width:850px; padding-top: 0px; padding-bottom: 0px; text-align: center;">
{% with mask|striptags|urlencode as mask_url %}
<h2 style="font-family: inter medium, Arial, system-ui, sans-serif;">
<img width="18" src="{{ SITE_ORIGIN }}/static/images/email-images/warning.png" style="margin: 0 5px;" alt="warning icon"/>
{% ftlmsg 'relay-disabled-your-mask' %}
</h2>
<p style="line-height: 200%; margin-bottom: 30px; padding: 20px 60px 20px 60px">
{% ftlmsg 'relay-received-spam-complaint-html' mask=mask %} {% ftlmsg 'relay-disabled-your-mask-detail-html' mask=mask %}
</p>
<a href="{{ SITE_ORIGIN }}/accounts/profile/#{{ mask_url }}">
{% ftlmsg 're-enable-your-mask' %}
</a>
{% endwith %}
</td>
</tr>
</table>

{% include "emails/direct_email_footer.html" %}

{% endwithftl %}
{% comment %}
Note that Django only loads strings from some Fluent files.
See privaterelay/ftl_bundles.py.
{% endcomment %}
{% load ftl %}
{% load email_extras %}
{% withftl bundle='privaterelay.ftl_bundles.main' language=language %}

{% include "emails/direct_email_header.html" %}

<style>
.button {
box-sizing: border-box;
padding: 15px 25px;
display: inline-block;
font-family: 'metropolis medium', system-ui, sans-serif;
text-decoration: none;
-webkit-text-size-adjust: none;
text-align: center;
color: #FFFFFF;
background-color: #0060df;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
width: auto;
max-width: 100%;
overflow-wrap: break-word;
word-break: break-word;
word-wrap: break-word;
font-size: 16px;
}
</style>
<table role="presentation" border="0" cellpadding="0" cellspacing="10px" style="padding: 30px;" align="center">
{% with mask|striptags|urlencode as mask_for_url %}
{% with "/accounts/profile/#"|add:mask_for_url as mask_url%}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice job constructing this string

<tr>
<td style="max-width:850px; padding-top: 0px; padding-bottom: 0px; text-align: center;">
<h2 style="font-family: inter medium, Arial, system-ui, sans-serif;">
<img width="18" src="{{ SITE_ORIGIN }}/static/images/email-images/warning.png" style="margin: 0 5px;" alt="warning icon"/>
{% ftlmsg 'reactivate-your-mask' %}
</h2>
</td>
</tr>
<tr>
<td style="max-width:850px; padding-top: 0px; padding-bottom: 0px;">
<p style="line-height: 1.5; margin-bottom: 1.5em">
{% ftlmsg 'relay-received-spam-complaint-and-deactivated-mask-html' mask=mask %} {% ftlmsg 'relay-disabled-your-mask-detail-html' mask=mask %}
</p>
<p style="line-height: 1.5; margin-bottom: 1.5em">
{% ftlmsg 'reactivate-mask-detail-html' mask_url=mask_url %}
</p>
<p style="line-height: 1.5; margin-bottom: 1.5em">
{% ftlmsg 'learn-about-blocking-html' learn_more_url='https://support.mozilla.org/kb/disable-email-forwarding-stop-receiving-emails-sent-through-masks' %}
</p>
</td>
</tr>
<tr>
<td style="max-width:850px; padding-top: 20px; padding-bottom: 20px; text-align: center;">
<a href="{{ mask_url }}"
target="_blank" class="button" style="color: #FFFFFF;" rel="noreferrer">
{% ftlmsg 'reactivate-your-mask' %}
</a>
</td>
</tr>
{% endwith %}
{% endwith %}
</table>

{% include "emails/direct_email_footer.html" %}

{% endwithftl %}
8 changes: 5 additions & 3 deletions emails/templates/emails/disabled_mask_for_spam.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{% load ftl %}
{% load email_extras %}
{% withftl bundle='privaterelay.ftl_bundles.main' language=language %}
{% ftlmsg 'relay-disabled-your-mask' %}
{% ftlmsg 'relay-deactivated-your-mask' %}

{% ftlmsg 'relay-received-spam-complaint' mask=mask %} {% ftlmsg 'relay-disabled-your-mask-detail' mask=mask %}
{% ftlmsg 'relay-received-spam-complaint-and-deactivated-mask' mask=mask %}
{% with mask|striptags|urlencode as mask_url %}
{% ftlmsg 're-enable-your-mask' %}
{% ftlmsg 'reactivate-mask-detail' %}
{{ SITE_ORIGIN }}/accounts/profile/#{{ mask_url }}
{% endwith %}

{% ftlmsg 'learn-about-blocking' learn_more_url='https://support.mozilla.org/kb/disable-email-forwarding-stop-receiving-emails-sent-through-masks' %}
{% endwithftl %}
96 changes: 70 additions & 26 deletions emails/tests/fixtures/disabled_mask_for_spam_expected.email
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Subject: =?utf-8?q?=E2=81=A8Firefox_Relay=E2=81=A9?= has disabled one of your
email masks.
Subject: =?utf-8?q?=E2=81=A8Firefox_Relay=E2=81=A9?= has deactivated one of
your email masks.
From: [email protected]
To: [email protected]
MIME-Version: 1.0
Expand All @@ -13,17 +13,21 @@ Content-Transfer-Encoding: quoted-printable



=E2=81=A8Firefox Relay=E2=81=A9 has disabled one of your email masks.
=E2=81=A8Firefox Relay=E2=81=A9 has deactivated one of your email masks.

=E2=81=A8Firefox Relay=E2=81=A9 received a spam complaint for an email sent t=
o [email protected]=E2=81=A9. This usually happens if you or your e=
mail provider mark an email as spam. To prevent further spam, =E2=81=A8Firefo=
x Relay=E2=81=A9 has disabled your [email protected]=E2=81=A9 mask.
An email from your mask address, [email protected]=E2=81=A9, was ma=
rked as spam. When this happens, =E2=81=A8Firefox Relay=E2=81=A9 deactivates =
the mask and stops forwarding emails.

Visit your =E2=81=A8Firefox Relay=E2=81=A9 dashboard to re-enable this mask.
To reactivate your mask, remove email blocking on your =E2=81=A8Firefox Relay=
=E2=81=A9 dashboard.
http://127.0.0.1:8000/accounts/profile/#w41fwbt4q%40test.com


Learn about blocking and email forwarding at =E2=81=A8https://support.mozilla=
.org/kb/disable-email-forwarding-stop-receiving-emails-sent-through-masks=E2=
=81=A9


--==[BOUNDARY0]==
Content-Type: text/html; charset="utf-8"
Expand Down Expand Up @@ -224,34 +228,74 @@ ail" style=3D"color: white;">Upgrade for more protection</a>=20
</table> =20


<style>
.button {
box-sizing: border-box;
padding: 15px 25px;
display: inline-block;
font-family: 'metropolis medium', system-ui, sans-serif;
text-decoration: none;
-webkit-text-size-adjust: none;
text-align: center;
color: #FFFFFF;
background-color: #0060df;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
width: auto;
max-width: 100%;
overflow-wrap: break-word;
word-break: break-word;
word-wrap: break-word;
font-size: 16px;
}
</style>
<table role=3D"presentation" border=3D"0" cellpadding=3D"0" cellspacing=
=3D"10px" style=3D"padding: 60px 30px 120px 30px;" align=3D"center">
=3D"10px" style=3D"padding: 30px;" align=3D"center">
=20
=20
<tr>
<td style=3D"max-width:850px; padding-top: 0px; padding-bottom: 0=
px; text-align: center;">
=20
<h2 style=3D"font-family: inter medium, Arial, system-ui, san=
s-serif;">=20
s-serif;">
<img width=3D"18" src=3D"http://127.0.0.1:8000/static/ima=
ges/email-images/warning.png" style=3D"margin: 0 5px;" alt=3D"warning icon"/>
=E2=81=A8Firefox Relay=E2=81=A9 has disabled one of your =
email masks.
Reactivate your email mask
</h2>
<p style=3D"line-height: 200%; margin-bottom: 30px; padding: =
20px 60px 20px 60px">
Firefox Relay received a spam complaint for an email sent to =
<strong>[email protected]</strong>. This usually happens if you or your emai=
l provider mark an email as spam. To prevent further spam, Firefox Relay has =
disabled your <strong>[email protected]</strong> mask.
</p>=20
<a href=3D"http://127.0.0.1:8000/accounts/profile/#w41fwbt4q%=
40test.com">
Visit your =E2=81=A8Firefox Relay=E2=81=A9 dashboard to r=
e-enable this mask.
</td>
</tr>
<tr>
<td style=3D"max-width:850px; padding-top: 0px; padding-bottom: 0=
px;">
<p style=3D"line-height: 1.5; margin-bottom: 1.5em">
An email from your mask address, [email protected], was mark=
ed as spam. When this happens, Firefox Relay deactivates the mask and stops f=
orwarding emails. ???
</p>
<p style=3D"line-height: 1.5; margin-bottom: 1.5em">
To reactivate your mask, <a href=3D"/accounts/profile/#w4=
1fwbt4q%40test.com">remove email blocking</a> on your Firefox Relay dashboard.
</p>
<p style=3D"line-height: 1.5; margin-bottom: 1.5em">
<a href=3D"https://support.mozilla.org/kb/disable-email-f=
orwarding-stop-receiving-emails-sent-through-masks">Learn about blocking and =
email forwarding</a>
</p>
</td>
</tr>
<tr>
<td style=3D"max-width:850px; padding-top: 20px; padding-bottom: =
20px; text-align: center;">
<a href=3D"/accounts/profile/#w41fwbt4q%40test.com"
target=3D"_blank" class=3D"button" style=3D"color: #FFFFFF;=
" rel=3D"noreferrer">
Reactivate your email mask
</a>
=20
</td>=20
</td>
</tr>
=20
=20
</table>

=20
Expand Down
4 changes: 2 additions & 2 deletions emails/tests/views_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ def test_complaint_disables_mask(self):
assert call.kwargs["Source"] == settings.RELAY_FROM_ADDRESS
assert call.kwargs["Destinations"] == [self.user.email]
msg_without_newlines = call.kwargs["RawMessage"]["Data"].replace("\n", "")
assert "To prevent further spam" in msg_without_newlines
assert "deactivated one of your email masks" in msg_without_newlines
assert self.ra.full_address in msg_without_newlines

mm.assert_incr_once(
Expand Down Expand Up @@ -1312,7 +1312,7 @@ def test_build_disabled_mask_for_spam_email(self):

msg = _build_disabled_mask_for_spam_email(relay_address, original_spam_email)

assert msg["Subject"] == main.format("relay-disabled-your-mask")
assert msg["Subject"] == main.format("relay-deactivated-your-mask")
assert msg["From"] == settings.RELAY_FROM_ADDRESS
assert msg["To"] == free_user.email

Expand Down
2 changes: 1 addition & 1 deletion emails/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ def _build_disabled_mask_for_spam_email(

# Create the message
msg = EmailMessage()
msg["Subject"] = ftl_bundle.format("relay-disabled-your-mask")
msg["Subject"] = ftl_bundle.format("relay-deactivated-your-mask")
msg["From"] = settings.RELAY_FROM_ADDRESS
msg["To"] = mask.user.email
msg.set_content(text_body)
Expand Down
59 changes: 36 additions & 23 deletions privaterelay/pending_locales/en/pending.ftl
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# This is the Django equivalent of frontend/pendingTranslations.ftl

## Email sent to users when Relay disables their mask after the user marks a forwarded
## email as spam.

relay-disabled-your-mask = { -brand-name-firefox-relay } has disabled one of your email masks.
# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-received-spam-complaint-html = { -brand-name-firefox-relay } received a spam complaint for an email sent to <strong>{ $mask }</strong>. This usually happens if you or your email provider mark an email as spam.
# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-received-spam-complaint = { -brand-name-firefox-relay } received a spam complaint for an email sent to { $mask }. This usually happens if you or your email provider mark an email as spam.
# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-disabled-your-mask-detail-html = To prevent further spam, { -brand-name-firefox-relay } has disabled your <strong>{ $mask }</strong> mask.
# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-disabled-your-mask-detail = To prevent further spam, { -brand-name-firefox-relay } has disabled your { $mask } mask.
re-enable-your-mask = Visit your { -brand-name-firefox-relay } dashboard to re-enable this mask.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# This is the Django equivalent of frontend/pendingTranslations.ftl

## Email sent to users when Relay deactivates their mask after the user marks a forwarded
## email as spam.

relay-deactivated-your-mask = { -brand-name-firefox-relay } has deactivated one of your email masks.

reactivate-your-mask = Reactivate your email mask

# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-received-spam-complaint-and-deactivated-mask-html = An email from your mask address, { $mask }, was marked as spam. When this happens, { -brand-name-firefox-relay } deactivates the mask and stops forwarding emails.

# Variables
# $mask (string) - the Relay email mask that sent a spam complaint
relay-received-spam-complaint-and-deactivated-mask = An email from your mask address, { $mask }, was marked as spam. When this happens, { -brand-name-firefox-relay } deactivates the mask and stops forwarding emails.

# Variables
# $mask_url (string) - url takes user to Relay dashboard with mask selected
reactivate-mask-detail-html = To reactivate your mask, <a href="{ $mask_url }">remove email blocking</a> on your { -brand-name-firefox-relay } dashboard.

reactivate-mask-detail = To reactivate your mask, remove email blocking on your { -brand-name-firefox-relay } dashboard.

# Variables
# $learn_more_url (string) - support.mozilla.org page with more information
learn-about-blocking-html = <a href="{ $learn_more_url }">Learn about blocking and email forwarding</a>

# Variables
# $learn_more_url (string) - support.mozilla.org page with more information
learn-about-blocking = Learn about blocking and email forwarding at { $learn_more_url }

re-enable-your-mask = Visit your { -brand-name-firefox-relay } dashboard to re-enable this mask.