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
diff --git a/reviewtools/email.py b/reviewtools/email.py
index 9f97129..ad0a621 100644
--- a/reviewtools/email.py
+++ b/reviewtools/email.py
@@ -20,7 +20,7 @@ import smtplib
20import sys20import sys
2121
22# The From address for all emails22# The From address for all emails
23email_from_addr = "Snap Store <noreply@canonical.com>"23email_from_addr = "Snap Store <noreply+security-snap-review@canonical.com>"
2424
25# Send via local SMTP server25# Send via local SMTP server
26email_server = "localhost"26email_server = "localhost"
@@ -85,6 +85,8 @@ def send(email_to_addr, subj, body, bcc=None):
8585
86 if "RT_EMAIL_SERVER" in os.environ:86 if "RT_EMAIL_SERVER" in os.environ:
87 email_server = os.environ["RT_EMAIL_SERVER"]87 email_server = os.environ["RT_EMAIL_SERVER"]
88 email_server_user = os.environ.get("RT_EMAIL_SERVER_USER")
89 email_server_password = os.environ.get("RT_EMAIL_SERVER_PASSWORD")
8890
89 if (91 if (
90 "RT_EMAIL_NOPROMPT" not in os.environ92 "RT_EMAIL_NOPROMPT" not in os.environ
@@ -109,7 +111,11 @@ def send(email_to_addr, subj, body, bcc=None):
109 msg["To"] = email_to_addr111 msg["To"] = email_to_addr
110 if bcc is not None:112 if bcc is not None:
111 msg["Bcc"] = bcc113 msg["Bcc"] = bcc
112 s = smtplib.SMTP(email_server)114 if email_server_user and email_server_password:
115 s = smtplib.SMTP_SSL(email_server)
116 s.login(email_server_user, email_server_password)
117 else:
118 s = smtplib.SMTP(email_server)
113 s.send_message(msg)119 s.send_message(msg)
114 s.quit()120 s.quit()
115121

Subscribers

People subscribed via source and target branches

to all changes: