aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-03 11:58:25 -0500
committerFrederick Muriuki Muriithi2024-06-03 11:58:25 -0500
commit7e3012af451778d2d63452590f8a6f137ff4a808 (patch)
treec212fd3093548a23e647e773757a3fffa7316ae6
parentc3b940f89523d54d2e2baf436122a30fc0aafdd9 (diff)
downloadgn-auth-7e3012af451778d2d63452590f8a6f137ff4a808.tar.gz
Log out emails in debug mode.
Log out emails sent when the application is in debug mode to help with maintenance efforts.
-rw-r--r--gn_auth/smtp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/gn_auth/smtp.py b/gn_auth/smtp.py
index 42d8eae..0c9f878 100644
--- a/gn_auth/smtp.py
+++ b/gn_auth/smtp.py
@@ -1,4 +1,5 @@
"""Handle sending emails. Uses Python3's `smtplib`."""
+import logging
import smtplib
import mimetypes
from typing import Optional
@@ -50,6 +51,7 @@ def send_message(# pylint: disable=[too-many-arguments]
source_address: Optional[tuple[tuple[str, int], ...]] = None
):
"""Set up a connection to a SMTP server and send a message."""
+ logging.debug("Email to send:\n******\n%s\n******\n", message.as_string())
with smtplib.SMTP(host, port, local_hostname, timeout, source_address) as conn:
conn.starttls()
conn.login(smtp_user, smtp_passwd)