From 12e78738d5d3a4fda2db33649c0db57bd3be1d77 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Fri, 5 Mar 2021 09:14:04 -0500 Subject: lttr: added templates to send emails to range test --- app/lttr/mailer.py | 17 +- .../lttr/emails/range_plain_text_email.txt | 5 +- .../lttr/emails/test-range_html_email.html | 246 +++++++++++++++++++++ .../lttr/emails/test-range_plain_text_email.txt | 19 ++ 4 files changed, 275 insertions(+), 12 deletions(-) create mode 100644 app/lttr/templates/lttr/emails/test-range_html_email.html create mode 100644 app/lttr/templates/lttr/emails/test-range_plain_text_email.txt (limited to 'app') diff --git a/app/lttr/mailer.py b/app/lttr/mailer.py index 7a3ce3f..9ddcfa0 100644 --- a/app/lttr/mailer.py +++ b/app/lttr/mailer.py @@ -36,16 +36,10 @@ class SendShit(): ) # New instance, try sending if created: - try: - email = self.build_message(subscriber) - status.status=1 - if self.verbose==1: - print("successfully sent %s the newsletter mailing %s"%(subscriber, self.mailing)) - except: - status.status=2 - if self.verbose == 1: - print("failed to send %s to %s"%(self.mailing, subscriber)) - status.save() + email = self.build_message(subscriber) + status.status=1 + if self.verbose==1: + print("successfully sent %s the newsletter mailing %s"%(subscriber, self.mailing)) else: # not new, check if error and resend or just continue if status.status == 2: @@ -74,9 +68,10 @@ class SendShit(): from_email, to = 'Scott Gilbertson ', subscriber.get_email() text_content = render_to_string(self.newsletter.get_template_plain(), {'object': self.mailing, 'subscriber':subscriber}) html_content = render_to_string(self.newsletter.get_template_html(), {'object': self.mailing, 'subscriber':subscriber}) - #print(text_content) + #print(html_content) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") + #msg.Header.Add('List-Unsubscribe', '' % subscriber.unsubscribe_activate_url) msg.send() ''' diff --git a/app/lttr/templates/lttr/emails/range_plain_text_email.txt b/app/lttr/templates/lttr/emails/range_plain_text_email.txt index 28e9b2b..cdb8c52 100644 --- a/app/lttr/templates/lttr/emails/range_plain_text_email.txt +++ b/app/lttr/templates/lttr/emails/range_plain_text_email.txt @@ -1,5 +1,8 @@ +Greetings Range subscribers- -{{ object.email_encode|safe }} +I respect your desire for plain text email, but there really isn't a way to do a photo newsletter in plain text, except to say, here's a link to the web-based version: + + ----- diff --git a/app/lttr/templates/lttr/emails/test-range_html_email.html b/app/lttr/templates/lttr/emails/test-range_html_email.html new file mode 100644 index 0000000..139ff33 --- /dev/null +++ b/app/lttr/templates/lttr/emails/test-range_html_email.html @@ -0,0 +1,246 @@ +{% load typogrify_tags %} + + + + + + + {{object.title}} + + + + + + + + + + + +
+
+ + + + +
+


+ ✪ Range — {{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/test-range_plain_text_email.txt b/app/lttr/templates/lttr/emails/test-range_plain_text_email.txt new file mode 100644 index 0000000..b823d2f --- /dev/null +++ b/app/lttr/templates/lttr/emails/test-range_plain_text_email.txt @@ -0,0 +1,19 @@ +Greetings Range subscribers- + +While I respect your desire for plain text email, there really isn't a way to do a photo newsletter in plain text other than to say, here's a link to the web-based version: + +<{{ object.get_absolute_url }}> + +----- + +You're getting this email because you signed up for + +Scott Gilbertson's (luxagraf)[https://luxagraf.net/] photo newsletter, + +*Range* [https://luxagraf.net/newsletter/range/] + +If you're new, you can explore past letters here: [https://luxagraf.net/newsletter/range/] + +You can always: Unsubscribe [https://luxagraf.net{{subscriber.unsubscribe_activate_url}}] instantly. + +[https://luxagraf.net/] ✪ [https://luxagraf.net/newsletter/range/] -- cgit v1.2.3-70-g09d2