Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'mailchimp'

  • Loading branch information...
commit b12e51b07be10a15db3bf1e79214895831cf732a 2 parents 2e7f2cb + 2dd1ec5
Alex Buchanan authored
View
7 apps/emailer/base.py
@@ -46,7 +46,11 @@ def get_html(self):
def get_from(self):
"""Return "from" email address."""
- return settings.DEFAULT_FROM_EMAIL
+ if self.email.from_email:
+ return '{name} <{email}>'.format(name=self.email.from_name,
+ email=self.email.from_email)
+ else:
+ return settings.DEFAULT_FROM_EMAIL
def get_recipients(self):
"""
@@ -62,6 +66,7 @@ def get_recipients(self):
def get_headers(self):
"""Return additional headers."""
return {
+ 'Reply-To': self.email.reply_to_email or settings.DEFAULT_FROM_EMAIL,
'X-Mailer': 'Basket Emailer %s' % (
'.'.join(map(str, settings.VERSION)))}
View
6 apps/emailer/models.py
@@ -25,6 +25,12 @@ class Email(models.Model):
'Python class name of custom Emailer to use. Example: '
'<code>emailer.emailers.MyFancyEmailer</code><br/>Keep empty for '
'default Emailer.'))
+ from_name = models.CharField(max_length=255, blank=True, help_text=(
+ "The sender's name (not an email address)"))
+ from_email = models.EmailField(blank=True, help_text=(
+ "The sender's address e.g. campaign@mozilla.com"))
+ reply_to_email = models.EmailField(blank=True, help_text=(
+ "The reply-to address"))
mailchimp_campaign = models.CharField(max_length=20, blank=True)
mailchimp_list = models.CharField(max_length=20, blank=True, help_text=(
"MailChimp list ID."
View
9 migrations/04-emailer-from-fields.sql
@@ -0,0 +1,9 @@
+ALTER TABLE emailer_email ADD COLUMN from_name varchar(255) NOT NULL;
+ALTER TABLE emailer_email ADD COLUMN from_email varchar(75) NOT NULL;
+ALTER TABLE emailer_email ADD COLUMN reply_to_email varchar(75) NOT NULL;
+UPDATE emailer_email SET from_name = 'Firefox Home Account Setup' WHERE name = 'iphone-reg';
+UPDATE emailer_email SET from_name = 'Firefox Home Account Setup' WHERE name = 'iphone-reminder';
+UPDATE emailer_email SET from_email = 'firefox-home-support@mozilla.com' WHERE name = 'iphone-reg';
+UPDATE emailer_email SET from_email = 'firefox-home-support@mozilla.com' WHERE name = 'iphone-reminder';
+UPDATE emailer_email SET reply_to_email = 'firefox-home-support@mozilla.com' WHERE name = 'iphone-reg';
+UPDATE emailer_email SET reply_to_email = 'firefox-home-support@mozilla.com' WHERE name = 'iphone-reminder';
Please sign in to comment.
Something went wrong with that request. Please try again.