diff options
Diffstat (limited to 'app/lttr/mailer.py')
-rw-r--r-- | app/lttr/mailer.py | 17 |
1 files changed, 6 insertions, 11 deletions
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 <sng@luxagraf.net>', 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', '<https://luxagraf.net%s>' % subscriber.unsubscribe_activate_url) msg.send() ''' |