Пример #1
0
def send_assigned_offer_reminder_email(
        template,
        learner_email,
        code,
        redeemed_offer_count,
        total_offer_count,
        code_expiration_date):
    """
    Arguments:
       *template*
           The email template with placeholders that will receive the following tokens
       *learner_email*
           Email of the customer who will receive the code.
       *code*
           Code for the user.
       *redeemed_offer_count*
           Number of times the code has been redeemed.
       *total_offer_count*
           Total number of offer assignments for this (code,email) pair
       *code_expiration_date*
           Date till code is valid.
    """

    email_subject = settings.OFFER_ASSIGNMENT_EMAIL_REMINDER_DEFAULT_SUBJECT
    email_body = template.format(
        REDEEMED_OFFER_COUNT=redeemed_offer_count,
        TOTAL_OFFER_COUNT=total_offer_count,
        USER_EMAIL=learner_email,
        CODE=code,
        EXPIRATION_DATE=code_expiration_date
    )
    send_offer_update_email.delay(learner_email, email_subject, email_body)
Пример #2
0
def send_assigned_offer_reminder_email(subject, greeting, closing,
                                       learner_email, code,
                                       redeemed_offer_count, total_offer_count,
                                       code_expiration_date, sender_alias):
    """
    Arguments:
        *subject*
            The email subject
        *email_greeting*
            The email greeting (prefix)
        *email_closing*
            The email closing (suffix)
       *learner_email*
           Email of the customer who will receive the code.
       *code*
           Code for the user.
       *redeemed_offer_count*
           Number of times the code has been redeemed.
       *total_offer_count*
           Total number of offer assignments for this (code,email) pair
       *code_expiration_date*
           Date till code is valid.
       *sender_alias*
           Enterprise customer sender alias.
    """
    email_template = settings.OFFER_REMINDER_EMAIL_TEMPLATE
    placeholder_dict = SafeDict(REDEEMED_OFFER_COUNT=redeemed_offer_count,
                                TOTAL_OFFER_COUNT=total_offer_count,
                                USER_EMAIL=learner_email,
                                CODE=code,
                                EXPIRATION_DATE=code_expiration_date)
    email_body = format_email(email_template, placeholder_dict, greeting,
                              closing)
    send_offer_update_email.delay(learner_email, subject, email_body,
                                  sender_alias)
Пример #3
0
def send_revoked_offer_email(
        subject,
        greeting,
        closing,
        learner_email,
        code
):
    """
    Arguments:
        *subject*
            The email subject
        *email_greeting*
            The email greeting (prefix)
        *email_closing*
            The email closing (suffix)
        *learner_email*
            Email of the customer who will receive the code.
        *code*
            Code for the user.
    """
    email_template = settings.OFFER_REVOKE_EMAIL_TEMPLATE
    placeholder_dict = SafeDict(
        USER_EMAIL=learner_email,
        CODE=code,
    )
    email_body = format_email(email_template, placeholder_dict, greeting, closing)
    send_offer_update_email.delay(learner_email, subject, email_body)
Пример #4
0
def send_revoked_offer_email(
        subject,
        greeting,
        closing,
        learner_email,
        code,
        sender_alias,
):
    """
    Arguments:
        *subject*
            The email subject
        *email_greeting*
            The email greeting (prefix)
        *email_closing*
            The email closing (suffix)
        *learner_email*
            Email of the customer who will receive the code.
        *code*
            Code for the user.
    """
    email_template = settings.OFFER_REVOKE_EMAIL_TEMPLATE
    placeholder_dict = SafeDict(
        USER_EMAIL=learner_email,
        CODE=code,
    )
    email_body = format_email(email_template, placeholder_dict, greeting, closing)

    if settings.DEBUG:  # pragma: no cover
        # Avoid breaking devstack when no such service is available.
        logger.warning("Skipping Sailthru task 'send_revoked_offer_email' because DEBUG=true.")  # pragma: no cover
        return  # pragma: no cover

    send_offer_update_email.delay(learner_email, subject, email_body, sender_alias)
Пример #5
0
def send_revoked_offer_email(template, learner_email, code):
    """
    Arguments:
        *template*
            The email template with placeholders that will receive the following tokens
        *learner_email*
            Email of the customer who will receive the code.
        *code*
            Code for the user.
    """

    email_subject = settings.OFFER_REVOKE_EMAIL_DEFAULT_SUBJECT

    email_body = template.format(
        USER_EMAIL=learner_email,
        CODE=code,
    )
    send_offer_update_email.delay(learner_email, email_subject, email_body)