From a551326ec05f761f58a0ba68b4ca8af95d9e652d Mon Sep 17 00:00:00 2001 From: luxagraf Date: Thu, 12 Nov 2020 10:39:33 -0500 Subject: rearranged email templates, added footer to plain text email. --- app/lttr/mailer.py | 7 +- app/lttr/models.py | 1 - .../templates/lttr/emails/friends_base_left.html | 176 ++++++++++++++ .../templates/lttr/emails/friends_html_email.html | 252 +++++++++++++++++++++ .../lttr/emails/friends_plain_text_email.txt | 16 ++ app/lttr/templates/lttr/friends_base.html | 252 --------------------- app/lttr/templates/lttr/friends_base_left.html | 176 -------------- 7 files changed, 448 insertions(+), 432 deletions(-) create mode 100644 app/lttr/templates/lttr/emails/friends_base_left.html create mode 100644 app/lttr/templates/lttr/emails/friends_html_email.html create mode 100644 app/lttr/templates/lttr/emails/friends_plain_text_email.txt delete mode 100644 app/lttr/templates/lttr/friends_base.html delete mode 100644 app/lttr/templates/lttr/friends_base_left.html (limited to 'app') diff --git a/app/lttr/mailer.py b/app/lttr/mailer.py index b5b875e..9972ea2 100644 --- a/app/lttr/mailer.py +++ b/app/lttr/mailer.py @@ -72,11 +72,12 @@ class SendShit(): """ subject = smart_str("%s: %s — %s" %(self.mailing.newsletter.title, self.mailing.get_issue_str(), self.mailing.title)) from_email, to = 'Scott Gilbertson ', subscriber.get_email() - text_content = self.mailing.email_encode() - html_content = render_to_string('lttr/friends_base.html', {'object': self.mailing, 'subscriber':subscriber}) + text_content = render_to_string('lttr/emails/friends_plain_text_email.txt', {'object': self.mailing, 'subscriber':subscriber}) + html_content = render_to_string('lttr/emails/friends_html_email.html', {'object': self.mailing, 'subscriber':subscriber}) + print(text_content) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") - msg.send() + #msg.send() ''' for header, value in self.newsletter.server.custom_headers.items(): diff --git a/app/lttr/models.py b/app/lttr/models.py index 51f620c..f702478 100644 --- a/app/lttr/models.py +++ b/app/lttr/models.py @@ -157,7 +157,6 @@ class NewsletterMailing(models.Model): return issue def email_encode(self): - return self.body_markdown @property diff --git a/app/lttr/templates/lttr/emails/friends_base_left.html b/app/lttr/templates/lttr/emails/friends_base_left.html new file mode 100644 index 0000000..f2b91e6 --- /dev/null +++ b/app/lttr/templates/lttr/emails/friends_base_left.html @@ -0,0 +1,176 @@ +{% load typogrify_tags %} + + + + + + + Friends of a Long Year + + + + + + + + + +
+
+ + + + +
+

+

+ +

+ {{object.pub_date|date:"F"}} {{object.pub_date|date:"j, Y"}}

+ {{object.body_email_html|safe|smartypants}} +
+
+
+ + + + + + + + + diff --git a/app/lttr/templates/lttr/emails/friends_html_email.html b/app/lttr/templates/lttr/emails/friends_html_email.html new file mode 100644 index 0000000..42e7795 --- /dev/null +++ b/app/lttr/templates/lttr/emails/friends_html_email.html @@ -0,0 +1,252 @@ +{% load typogrify_tags %} + + + + + + + {{object.title}} + + + + + + + + + + + +
+
+ + + + +
+


+ Friends of a Long Year — {{object.get_issue_str}} — {{object.pub_date|date:"F"}} {{object.pub_date|date:"j, Y"}}

+

{{object.title|safe|smartypants}}

+ +
+ + {% include "lib/friends_featured_img.html" with image=object.featured_image %} + +
+
+ + {{object.body_email_html|safe|smartypants}} + +
+
+
+
+ + + + + + + + + + diff --git a/app/lttr/templates/lttr/emails/friends_plain_text_email.txt b/app/lttr/templates/lttr/emails/friends_plain_text_email.txt new file mode 100644 index 0000000..729d83a --- /dev/null +++ b/app/lttr/templates/lttr/emails/friends_plain_text_email.txt @@ -0,0 +1,16 @@ + +{{ object.email_encode }} + +----- + +You're getting this email because you signed up for + +Scott Gilbertson's (luxagraf)[https://luxagraf.net/] newsletter, + +*Friends of a Long Year* [https://luxagraf.net/newsletter/friends/] + +If you're new, you can explore past letters here: [https://luxagraf.net/newsletter/friends/] + +You can always: Unsubscribe [https://luxagraf.net{{subscriber.unsubscribe_activate_url}}] instantly. + +[https://luxagraf.net/] ✪ [https://luxagraf.net/newsletter/friends/] diff --git a/app/lttr/templates/lttr/friends_base.html b/app/lttr/templates/lttr/friends_base.html deleted file mode 100644 index 42e7795..0000000 --- a/app/lttr/templates/lttr/friends_base.html +++ /dev/null @@ -1,252 +0,0 @@ -{% load typogrify_tags %} - - - - - - - {{object.title}} - - - - - - - - - - - -
-
- - - - -
-


- Friends of a Long Year — {{object.get_issue_str}} — {{object.pub_date|date:"F"}} {{object.pub_date|date:"j, Y"}}

-

{{object.title|safe|smartypants}}

- -
- - {% include "lib/friends_featured_img.html" with image=object.featured_image %} - -
-
- - {{object.body_email_html|safe|smartypants}} - -
-
-
-
- - - - - - - - - - diff --git a/app/lttr/templates/lttr/friends_base_left.html b/app/lttr/templates/lttr/friends_base_left.html deleted file mode 100644 index f2b91e6..0000000 --- a/app/lttr/templates/lttr/friends_base_left.html +++ /dev/null @@ -1,176 +0,0 @@ -{% load typogrify_tags %} - - - - - - - Friends of a Long Year - - - - - - - - - -
-
- - - - -
-

-

- -

- {{object.pub_date|date:"F"}} {{object.pub_date|date:"j, Y"}}

- {{object.body_email_html|safe|smartypants}} -
-
-
- - - - - - - - - -- cgit v1.2.3