Example #1
0
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()
Example #2
0
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()
Example #3
0
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()
Example #4
0
def new_client_alert(recipients, text):
    """
    Task for sending email on new client sign-up
    """
    subject = 'New Client Signup'
    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()
Example #5
0
def send_published_article(
    date_string, sender, recipient, subject, byline, email_text, story_text, mediaitems=None, 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,
        "mediaitems": mediaitems,
    }
    email.text("../templates/templated_email/emaila.txt", ctx)
    email.html("../templates/templated_email/emaila.html", ctx)
    if attachment:
        email.add_attachment(attachment)
    email.send()
Example #6
0
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()
Example #7
0
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()
Example #8
0
def email_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()