#3958: Fixes to Expiring Soon emails - [RH] (#3960)

* Update dryrun output, email spacing, and update timing of when email sends out (7AMPT/10AMET)
This commit is contained in:
Slim 2025-07-17 10:27:52 -07:00 committed by GitHub
parent 8cdd58741c
commit 48bc6e568a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 27 additions and 17 deletions

View file

@ -3,8 +3,8 @@ run-name: Run notifications
on:
schedule:
# Runs every day at 5:30 AM UTC.
- cron: "30 5 * * *"
# Runs every day at 14:00 UTC/7:00AM PT/10:00AM ET
- cron: "0 14 * * *"
jobs:
run-notifications:

View file

@ -9,6 +9,7 @@ from django.utils import timezone
from registrar.models import Domain, UserDomainRole, UserPortfolioPermission
from registrar.models.user import UserPortfolioRoleChoices
from registrar.utility.email import send_templated_email, EmailSendingError
from django.template.loader import render_to_string
logger = logging.getLogger(__name__)
@ -84,9 +85,16 @@ class Command(BaseCommand):
try:
if dryrun:
rendered_subject = render_to_string(subject_template, context).strip()
rendered_body = render_to_string(template, context)
logger.info(
f"[DRYRUN] Would send email for domain {domain.name} where "
f"TO: {domain_manager_emails} || CC: {portfolio_admin_emails}"
f"[DRYRUN]\n"
f"Would send email for domain {domain.name}\n"
f"TO: {domain_manager_emails}\n"
f"CC: {portfolio_admin_emails}\n"
f"Subject: {rendered_subject}\n"
f"Body:\n{rendered_body}"
)
else:
send_templated_email(

View file

@ -1,22 +1,23 @@
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
Hi, domain managers.
On {{ expiration_date }}, the following domain will expire: {{ domain }}
----------------------------------------------------------------
DOMAIN AT RISK FOR DELETION
Currently, {{ domain }} doesnt have name servers listed in the .gov registrar. If the domain expires without name servers, it will be deleted. To prevent deletion, you must renew this domain before {{ expiration_date }}.
HOW TO RENEW A DOMAIN
Theres no cost to renew a domain. After renewal, the domain will be registered for another year.
Any domain manager can complete the process within the .gov registrar <{{ manage_url }}>.
{% if portfolio %}
Organization admins are ccd on this email for awareness but do not need to take action.
{% endif %}
Any domain manager can complete the process within the .gov registrar <{{ manage_url }}>. {% if portfolio %} Organization admins are ccd on this email for awareness but do not need to take action.{% endif %}
If you no longer need {{ domain }}, simply let the domain expire.
THANK YOU
.Gov helps the public identify official, trusted information. Thank you for requesting a .gov domain.
.Gov helps the public identify official, trusted information. Thank you for using a .gov domain.
----------------------------------------------------------------

View file

@ -1,22 +1,23 @@
{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
Hi, domain managers.
On {{ expiration_date }}, the following domain will expire: {{ domain }}
----------------------------------------------------------------
----------------------------------------------------------------
HOW TO RENEW A DOMAIN
Theres no cost to renew a domain. After renewal, the domain will be registered for another year.
Any domain manager can complete the process within the .gov registrar <{{ manage_url }}>.
{% if portfolio %}
Organization admins are ccd on this email for awareness but do not need to take action.
{% endif %}
Any domain manager can complete the process within the .gov registrar <{{ manage_url }}>. {% if portfolio %} Organization admins are ccd on this email for awareness but do not need to take action. {% endif %}
WHAT HAPPENS IF THE DOMAIN EXPIRES?
When a .gov domain expires, its not automatically put on hold or deleted. It continues to resolve online even after its expiration date. Before we delete the domain, well make every effort to contact your organization. We encourage you to renew the domain promptly if you're still using it.
If you no longer need {{ domain }}, reply to this email and let us know that youd like to delete it.
THANK YOU
.Gov helps the public identify official, trusted information. Thank you for requesting a .gov domain.
.Gov helps the public identify official, trusted information. Thank you for using a .gov domain.
----------------------------------------------------------------