From 6426586a449ed5fec9e75e3743582ca4647c6694 Mon Sep 17 00:00:00 2001 From: Jeremy Edberg Date: Fri, 19 Sep 2008 15:26:30 -0700 Subject: [PATCH] stats should only connect to the mail server if sending mail --- r2/r2/lib/utils/reporting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r2/r2/lib/utils/reporting.py b/r2/r2/lib/utils/reporting.py index d7907b0c2..bc69aab1a 100644 --- a/r2/r2/lib/utils/reporting.py +++ b/r2/r2/lib/utils/reporting.py @@ -157,9 +157,9 @@ def run(period=None, date=None, show_all_time=True, sender=None, recipients=None, smtpserver=None): if not date and not period: date = yesterday() - session = smtplib.SMTP(smtpserver) report = TextReport(period, date).build(show_all_time=show_all_time) if sender: + session = smtplib.SMTP(smtpserver) report = "To: %s\n" % ', '.join(recipients) + report smtpresult = session.sendmail(sender, recipients, report) else: