Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/reports/bin/mailDigests.py

Issue 6246174612783104: Issue 535 - Contact form cannot deal with commas in sender`s name (Closed)
Patch Set: Created May 22, 2014, 8:13 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/reports/bin/mailDigests.py
===================================================================
--- a/sitescripts/reports/bin/mailDigests.py
+++ b/sitescripts/reports/bin/mailDigests.py
@@ -15,17 +15,17 @@
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
import MySQLdb, os, sys, re, marshal
from datetime import date
from time import time
from email.utils import parseaddr
from sitescripts.utils import get_config, setupStderr
-from sitescripts.templateFilters import formatmime
+from sitescripts.templateFilters import formatmime, emailaddr
from sitescripts.reports.utils import mailDigest, getReports, getReportSubscriptions, calculateReportSecret, getDigestId, getDigestSecret, getUserUsefulnessScore
import sitescripts.subscriptions.subscriptionParser as subscriptionParser
def loadSubscriptions():
global interval, weekDay
subscriptions = subscriptionParser.readSubscriptions()
@@ -122,18 +122,18 @@ def sendNotifications(reports):
def sendMail(subscription, groups):
if hasattr(subscription, 'email'):
email = subscription.email
else:
email = subscription['email']
name, address = parseaddr(email)
- email = formatmime(name) + ' <' + formatmime(address) + '>'
-
+ email = formatmime(emailaddr((name, address)))
+
id = getDigestId(address)
digestLink = get_config().get('reports', 'urlRoot') + 'digest?id=%s&secret=%s' % (id, getDigestSecret(id, date.today().isocalendar()))
mailDigest({'email': email, 'digestLink': digestLink, 'subscription': subscription, 'groups': groups})
def calculateReportWeight(report, subscriptions):
global currentTime, startTime

Powered by Google App Engine
This is Rietveld