diff --git a/src/registrar/management/commands/generate_test_transition_domains.py b/src/registrar/management/commands/generate_test_transition_domains.py
index 911857a1c..20aba2c58 100644
--- a/src/registrar/management/commands/generate_test_transition_domains.py
+++ b/src/registrar/management/commands/generate_test_transition_domains.py
@@ -29,16 +29,21 @@ class Command(BaseCommand):
)
def handle(self, **options):
- """Delete existing TransitionDomains. Generate test ones."""
+ """Delete existing TransitionDomains. Generate test ones.
+ expects options[emails]; emails will be assigned to transition
+ domains at the time of creation"""
# split options[emails] into an array of test emails
test_emails = options["emails"].split(",")
- # setting up test data
- self.delete_test_transition_domains()
- self.load_test_transition_domains(test_emails)
+ if len(test_emails) > 0:
+ # set up test data
+ self.delete_test_transition_domains()
+ self.load_test_transition_domains(test_emails)
+ else:
+ logger.error("list of emails for testing is required")
- def load_test_transition_domains(self, test_emails):
+ def load_test_transition_domains(self, test_emails: list):
"""Load test transition domains"""
# counter for test_emails index
diff --git a/src/registrar/management/commands/send_domain_invitations.py b/src/registrar/management/commands/send_domain_invitations.py
index 3f3542c70..4c595a2b5 100644
--- a/src/registrar/management/commands/send_domain_invitations.py
+++ b/src/registrar/management/commands/send_domain_invitations.py
@@ -42,7 +42,7 @@ class Command(BaseCommand):
def handle(self, **options):
"""Process the objects in TransitionDomain."""
- logger.debug("checking domains and preparing emails")
+ logger.info("checking domains and preparing emails")
# Get all TransitionDomain objects
self.transition_domains = TransitionDomain.objects.filter(
email_sent=False,
@@ -51,15 +51,15 @@ class Command(BaseCommand):
self.build_emails_to_send_array()
if options["send_emails"]:
- logger.debug("about to send emails")
+ logger.info("about to send emails")
self.send_emails()
- logger.debug("done sending emails")
+ logger.info("done sending emails")
self.update_domains_as_sent()
- logger.debug("done sending emails and updating transition_domains")
+ logger.info("done sending emails and updating transition_domains")
else:
- logger.debug("not sending emails")
+ logger.info("not sending emails")
def build_emails_to_send_array(self):
"""this method sends emails to distinct usernames"""
@@ -104,13 +104,16 @@ class Command(BaseCommand):
f"error retrieving domain {transition_domain.domain_name}: {err}"
)
# if there are at least one more transition domains than errors,
- # then send one more
+ # then append one more item
if len(self.transition_domains) > len(self.domains_with_errors):
self.emails_to_send.append(email_context)
def send_emails(self):
- for email_data in self.emails_to_send:
- self.send_email(email_data)
+ if len(self.emails_to_send) > 0:
+ for email_data in self.emails_to_send:
+ self.send_email(email_data)
+ else:
+ logger.info("no emails to send")
def send_email(self, email_data):
try:
@@ -122,8 +125,8 @@ class Command(BaseCommand):
"domains": email_data["domains"],
},
)
- # if log level set to debug, success message is logged
- logger.debug(
+ # success message is logged
+ logger.info(
f"email sent successfully to {email_data['email']} for "
f"{[domain['name'] for domain in email_data['domains']]}"
)
diff --git a/src/registrar/templates/emails/transition_domain_invitation.txt b/src/registrar/templates/emails/transition_domain_invitation.txt
index 8b7389c04..146db9743 100644
--- a/src/registrar/templates/emails/transition_domain_invitation.txt
+++ b/src/registrar/templates/emails/transition_domain_invitation.txt
@@ -1,11 +1,29 @@
-You have been invited to manage {% if domains|length > 1 %}multiple domains{% else %}the domain {{ domains.0.name }}{% endif %} on get.gov,
-the registrar for .gov domain names.
-{%if domains|length > 1 %}
-To accept your invitation, go to each of the following urls:
- {% for domain in domains %}
- {{ domain.url }} (to manage {{ domain.name }})
- {% endfor %}
-{% else %}
-To accept your invitation, go to <{{ domains.0.url }}>.
+{% autoescape off %}{# In a text file, we don't want to have HTML entities escaped #}
+Hi.
+
+You have been added as a manager on {% if domains|length > 1 %}multiple domains (listed below){% else %}{{ domains.0.name }}{% endif %}.
+
+YOU NEED A LOGIN.GOV ACCOUNT
+You’ll need a Login.gov account to manage your .gov domain{% if domains|length > 1 %}s{% endif %}. Login.gov provides a simple and secure process for signing into many government services with one account. If you don’t already have one, follow these steps to create your Login.gov account .
+
+DOMAIN MANAGEMENT
+As a .gov domain manager you can add or update information about your domain{% if domains|length > 1 %}s{% endif %}. You’ll also serve as a contact for your .gov domain{% if domains|length > 1 %}s{% endif %}. Please keep your contact information updated. Learn more about domain management .
+{% if domains|length > 1 %}
+DOMAINS
+{% for domain in domains %} {{ domain.name }}
+{% endfor %}{% else %}
{% endif %}
-You will need to log in with a Login.gov account using this email address.
+SOMETHING WRONG?
+If you’re not affiliated with {{ domain.name }} or think you received this message in error, contact the .gov team .
+
+
+THANK YOU
+
+.Gov helps the public identify official, trusted information. Thank you for using a .gov domain.
+
+----------------------------------------------------------------
+
+The .gov team
+Contact us:
+Visit
+{% endautoescape %}
diff --git a/src/registrar/templates/emails/transition_domain_invitation_subject.txt b/src/registrar/templates/emails/transition_domain_invitation_subject.txt
index 380b338b2..9302a748e 100644
--- a/src/registrar/templates/emails/transition_domain_invitation_subject.txt
+++ b/src/registrar/templates/emails/transition_domain_invitation_subject.txt
@@ -1 +1 @@
-You are invited to manage {% if domains|length > 1 %}multiple domains{% else %}{{ domains.0 }}{% endif %} on get.gov
+You've been added to a .gov domain
\ No newline at end of file