Merge ~hloeung/review-tools:master into review-tools:master

Proposed by Haw Loeung
Status: Merged
Merged at revision: caa5857d6e7f64005fc1237ae7ef5e3999cdebe8
Proposed branch: ~hloeung/review-tools:master
Merge into: review-tools:master
Diff against target: 34 lines (+8/-2)
1 file modified
reviewtools/email.py (+8/-2)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Review via email: mp+407134@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Murray (alexmurray) wrote :

Thanks, LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reviewtools/email.py b/reviewtools/email.py
2index 9f97129..ad0a621 100644
3--- a/reviewtools/email.py
4+++ b/reviewtools/email.py
5@@ -20,7 +20,7 @@ import smtplib
6 import sys
7
8 # The From address for all emails
9-email_from_addr = "Snap Store <noreply@canonical.com>"
10+email_from_addr = "Snap Store <noreply+security-snap-review@canonical.com>"
11
12 # Send via local SMTP server
13 email_server = "localhost"
14@@ -85,6 +85,8 @@ def send(email_to_addr, subj, body, bcc=None):
15
16 if "RT_EMAIL_SERVER" in os.environ:
17 email_server = os.environ["RT_EMAIL_SERVER"]
18+ email_server_user = os.environ.get("RT_EMAIL_SERVER_USER")
19+ email_server_password = os.environ.get("RT_EMAIL_SERVER_PASSWORD")
20
21 if (
22 "RT_EMAIL_NOPROMPT" not in os.environ
23@@ -109,7 +111,11 @@ def send(email_to_addr, subj, body, bcc=None):
24 msg["To"] = email_to_addr
25 if bcc is not None:
26 msg["Bcc"] = bcc
27- s = smtplib.SMTP(email_server)
28+ if email_server_user and email_server_password:
29+ s = smtplib.SMTP_SSL(email_server)
30+ s.login(email_server_user, email_server_password)
31+ else:
32+ s = smtplib.SMTP(email_server)
33 s.send_message(msg)
34 s.quit()
35

Subscribers

People subscribed via source and target branches

to all changes: