diff options
author | luxagraf <sng@luxagraf.net> | 2020-11-12 10:39:33 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-11-12 10:39:33 -0500 |
commit | a551326ec05f761f58a0ba68b4ca8af95d9e652d (patch) | |
tree | 3c449c61432606a8d41d04b4499739db8fb7b780 | |
parent | 74b2bb76ca3be85092a978ee60d26340c7e789a8 (diff) |
rearranged email templates, added footer to plain text email.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | TODO | 12 | ||||
-rw-r--r-- | app/lttr/mailer.py | 7 | ||||
-rw-r--r-- | app/lttr/models.py | 1 | ||||
-rw-r--r-- | app/lttr/templates/lttr/emails/friends_base_left.html (renamed from app/lttr/templates/lttr/friends_base_left.html) | 0 | ||||
-rw-r--r-- | app/lttr/templates/lttr/emails/friends_html_email.html (renamed from app/lttr/templates/lttr/friends_base.html) | 0 | ||||
-rw-r--r-- | app/lttr/templates/lttr/emails/friends_plain_text_email.txt | 16 | ||||
-rw-r--r-- | config/requirements.txt | 75 |
8 files changed, 89 insertions, 24 deletions
@@ -25,3 +25,5 @@ siteold/ /*.json .vagrant/ *.log +current.sql +mammals.txt @@ -0,0 +1,12 @@ +* add footer to plain text emails + + + + +Notes: + +Fix out of sequence postgres tables: + + +ALTER TABLE lttr_subscriber ALTER COLUMN id SET DEFAULT nextval('lttr_subscriber_id_seq'::regclass); +SELECT setval('lttr_subscriber_id_seq', (SELECT MAX(id) FROM lttr_subscriber)+1) 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 <sng@luxagraf.net>', 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/friends_base_left.html b/app/lttr/templates/lttr/emails/friends_base_left.html index f2b91e6..f2b91e6 100644 --- a/app/lttr/templates/lttr/friends_base_left.html +++ b/app/lttr/templates/lttr/emails/friends_base_left.html diff --git a/app/lttr/templates/lttr/friends_base.html b/app/lttr/templates/lttr/emails/friends_html_email.html index 42e7795..42e7795 100644 --- a/app/lttr/templates/lttr/friends_base.html +++ b/app/lttr/templates/lttr/emails/friends_html_email.html 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/config/requirements.txt b/config/requirements.txt index 2bbeb1e..c9c8afb 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,33 +1,68 @@ -beautifulsoup4==4.7.1 -bleach==3.1.0 -certifi==2018.11.29 +asgiref==3.2.10 +backcall==0.1.0 +beautifulsoup4==4.6.3 +bleach==3.0.0 +boto==2.49.0 +cairocffi==0.9.0 +CairoSVG==2.2.1 +certifi==2018.8.24 +cffi==1.11.5 chardet==3.0.4 -Django==2.1.7 -django-bleach==0.5.1 -django-debug-toolbar==1.11 -django-extensions==2.1.6 +click==7.1.2 +cssselect==1.1.0 +cssselect2==0.2.1 +decorator==4.3.0 +defusedxml==0.5.0 +Django==3.1 +django-autocomplete-light==3.3.2 +django-bleach==0.3.0 +django-debug-toolbar==2.2 +django-extensions==3.0.4 django-gravatar2==1.4.2 -django-taggit==0.24.0 +django-ses==0.8.14 +django-taggit==1.3.0 django-typogrify==1.3.3 -EbookLib==0.17.1 -idna==2.8 +EbookLib==0.17 +future==0.18.2 +gpxpy==1.3.5 +html5lib==1.0.1 +idna==2.7 +ipython==7.1.1 +ipython-genutils==0.2.0 +jedi==0.13.1 Jinja2==2.10 jsmin==2.2.2 -lxml==4.3.1 +lxml==4.2.5 Markdown==3.0.1 -MarkupSafe==1.1.1 -Pillow==5.4.1 +MarkupSafe==1.0 +parsel==1.6.0 +parso==0.3.1 +pdfrw==0.4 +pexpect==4.6.0 +pickleshare==0.7.5 +Pillow==5.3.0 pkg-resources==0.0.0 -psycopg2==2.7.7 +prompt-toolkit==2.0.6 +psycopg2==2.7.5 psycopg2-binary==2.7.7 +ptyprocess==0.6.0 +pycparser==2.19 PyExifTool==0.1 -python-resize-image==1.1.18 -pytz==2018.9 -requests==2.21.0 -six==1.12.0 +Pygments==2.2.0 +Pyphen==0.9.5 +python-resize-image==1.1.17 +pytz==2018.5 +PyYAML==5.3.1 +requests==2.19.1 +selectorlib==0.16.0 +six==1.11.0 smartypants==2.0.1 -soupsieve==1.8 sqlparse==0.2.4 +tinycss2==0.6.1 +traitlets==4.3.2 typogrify==2.0.7 -urllib3==1.24.1 +urllib3==1.23 +w3lib==1.22.0 +wcwidth==0.1.7 +WeasyPrint==0.42.3 webencodings==0.5.1 |