Skip to content

Commit

Permalink
login auth for SMTP sender
Browse files Browse the repository at this point in the history
  • Loading branch information
q committed Oct 28, 2024
1 parent c6398ea commit 34abd1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions irrd/conf/known_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"smtp": {},
"recipient_override": {},
"notification_header": {},
"username": {},
"password": {},
},
"auth": {
"override_password": {},
Expand Down
4 changes: 4 additions & 0 deletions irrd/utils/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@ def send_email(recipient, subject, body) -> None:

assert msg["From"]
s = SMTP(get_setting("email.smtp"))

if username := get_setting("email.username"):
s.login(username, get_setting("email.password"))

s.send_message(msg)
s.quit()

0 comments on commit 34abd1a

Please sign in to comment.