about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn_auth/auth/authorisation/users/views.py1
-rw-r--r--gn_auth/settings.py1
-rw-r--r--gn_auth/smtp.py8
3 files changed, 6 insertions, 4 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index eb1870f..363da92 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -154,6 +154,7 @@ def send_verification_email(
         send_message(smtp_user=current_app.config["SMTP_USER"],
                      smtp_passwd=current_app.config["SMTP_PASSWORD"],
                      message=build_email_message(
+                         from_address=current_app.config["EMAIL_ADDRESS"],
                          to_addresses=(user_address(user),),
                          subject=subject,
                          txtmessage=__render__("emails/verify-email.txt"),
diff --git a/gn_auth/settings.py b/gn_auth/settings.py
index 6015560..2a78be3 100644
--- a/gn_auth/settings.py
+++ b/gn_auth/settings.py
@@ -42,3 +42,4 @@ SMTP_PORT = 587
 SMTP_TIMEOUT = 200 # seconds
 SMTP_USER = "no-reply@genenetwork.org"
 SMTP_PASSWORD = "asecrettoken"
+EMAIL_ADDRESS = "no-reply@uthsc.edu"
diff --git a/gn_auth/smtp.py b/gn_auth/smtp.py
index a2d86b0..3306765 100644
--- a/gn_auth/smtp.py
+++ b/gn_auth/smtp.py
@@ -17,17 +17,17 @@ def __read_mime__(filepath) -> dict:
 
 
 def build_email_message(# pylint: disable=[too-many-arguments]
+        from_address: str,
         to_addresses: tuple[Address, ...],
         subject: str,
         txtmessage: str,
         htmlmessage: str = "",
-        attachments: tuple[str, ...] = tuple(),
-        from_address: Address = Address(
-            "GeneNetwork Automated Emails", "no-reply", "uthsc.edu")
+        attachments: tuple[str, ...] = tuple()
 ) -> EmailMessage:
     """Build an email message."""
     msg = EmailMessage()
-    msg["From"] = from_address
+    msg["From"] = Address(display_name="GeneNetwork Automated Emails",
+                          addr_spec=from_address)
     msg["To"] = to_addresses
     msg["Subject"] = subject
     msg.set_content(txtmessage)