def new_client_alert(sender, recipients, subject, text): """ Task for sending email on new client sign-up """ for r in recipients: email = EMail(subject, r) ctx = {'subject': subject, 'text': text} email.text('../templates/templated_email/newclientalert.txt', ctx) email.html('../templates/templated_email/newclientalert.html', ctx) email.send()
def alert_editor(sender, subject, byline, text): """ Task for sending email on stories marked as ready_for_editor in a submitted reporter form. """ recipients = [] for profile in UserProfile.objects.filter(user_type='Editor'): recipients.append(profile.user.email) for r in recipients: email = EMail(subject, r) ctx = {'subject': subject, 'byline': byline, 'text': text} email.text('../templates/templated_email/ready_for_editor.txt', ctx) email.html('../templates/templated_email/ready_for_editor.html', ctx) email.send()
def send_published_article(date_string, sender, recipient, subject, byline, email_text, story_text, attachment=None): """ Task for sending each email, gets called by create_email_batch """ email = EMail(subject, recipient) ctx = { 'subject': subject, 'story_text': story_text, 'email_text': email_text, 'byline': byline } email.text('../templates/templated_email/emaila.txt', ctx) email.html('../templates/templated_email/emaila.html', ctx) if attachment: email.add_attachment(attachment) email.send()