From: hernani Date: Fri, 9 Dec 2011 15:07:18 +0000 (+0000) Subject: Adds an option to set a reply-to address on emails X-Git-Tag: live~108 X-Git-Url: https://git.openstreetmap.org/osqa.git/commitdiff_plain/ad7569ba83d33a796b896e6dfc9641edcaf272c3 Adds an option to set a reply-to address on emails git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1209 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/settings/email.py b/forum/settings/email.py index 583ab0d..7922385 100644 --- a/forum/settings/email.py +++ b/forum/settings/email.py @@ -43,6 +43,11 @@ label = _("Site 'from' Email Address"), help_text = _("The address that will show up on the 'from' field on emails sent by your website."), required=False)) +DEFAULT_REPLY_TO_EMAIL = Setting('DEFAULT_REPLY_TO_EMAIL', '', EMAIL_SET, dict( +label = _("Site 'reply-to' Email Address"), +help_text = _("The address that will show up on the 'reply-to' field on emails sent by your website."), +required=False)) + EMAIL_SUBJECT_PREFIX = Setting('EMAIL_SUBJECT_PREFIX', '', EMAIL_SET, dict( label = _("Email Subject Prefix"), help_text = _("Every email sent through your website will have the subject prefixed by this string. It's usually a good idea to have such a prefix so your users can easily set up a filter on their email clients."), diff --git a/forum/utils/mail.py b/forum/utils/mail.py index 84a79b3..cecb5b4 100644 --- a/forum/utils/mail.py +++ b/forum/utils/mail.py @@ -52,6 +52,8 @@ def create_and_send_mail_messages(messages): sender.append('<%s>' % unicode(settings.DEFAULT_FROM_EMAIL)) sender = u'%s <%s>' % (unicode(settings.APP_SHORT_NAME), unicode(settings.DEFAULT_FROM_EMAIL)) + reply_to = unicode(settings.DEFAULT_REPLY_TO_EMAIL) + try: connection = None @@ -71,6 +73,9 @@ def create_and_send_mail_messages(messages): to.append('<%s>' % recipient.email) msgRoot['To'] = to + if reply_to: + msgRoot['Reply-To'] = reply_to + msgRoot.preamble = 'This is a multi-part message from %s.' % unicode(settings.APP_SHORT_NAME).encode('utf8') msgAlternative = MIMEMultipart('alternative')