email: Add more debugging when sending emails

We're currently spamming an uploader, and it's hard to figure out why.
Let's output why we are deciding to do so.
master
Iain Lane 5 years ago
parent e51cc58a2b
commit 879e7e1088
No known key found for this signature in database
GPG Key ID: E352D5C51C5041D4

@ -232,8 +232,9 @@ class EmailPolicy(BasePolicy, Rest):
recipients = ', '.join(emails)
msg = MESSAGE.format(**locals())
try:
self.log("%s/%s stuck for %d days, emailing %s" %
(source_name, version, age, recipients))
self.log("%s/%s stuck for %d days (email last sent at %d days old, "
"threshold for sending %d days), emailing %s" %
(source_name, version, age, last_sent, last_due, recipients))
server = smtplib.SMTP(self.email_host)
server.sendmail('noreply@canonical.com', emails, msg)
server.quit()

Loading…
Cancel
Save