def _presentation_dealer_email(request, to_email, presentation_id):
    try:
        data_option = DataOption.objects.get(option_type="PRE-BOOK_TITLE")
        presentation = Presentation.objects.get(pk=presentation_id)
        presentation_url = "{}presentations/{}/view".format(settings.WEB_URL_BASE, presentation_id)
        prebook_title = data_option.value

        data_object = {
            "image_path": settings.EMAIL_STATIC_URL,
            "presentation_url": presentation_url,
            "presentation": presentation,
            "prebook_title": prebook_title,
            "dealer": presentation.user_profile.company.title()
        }

        from_email = "CobianUSA <*****@*****.**>"
        email_subject = "Cobian Prebook Proposal with Discounts"
        email_body = make_html_email('emails/presentation_dealer_email', data_object,
                                     context_instance=RequestContext(request))

        return send_email(email_subject, email_body, to_email, from_email)

    except Exception, e:
        logger.error("_presentation_dealer_email: {}".format(e))
        raise e
Exemple #2
0
def send_pre_authorized_email(request, warranty):
    user_profile = request.user.get_profile()
    email = user_profile.user.email

    emails = [email, warranty.email]
    email_subject = "Cobian Warranty Claim"
    email_body = make_html_email('emails/warranty_pre_authorized',
                                 {"warranty": warranty},
                                 context_instance=RequestContext(request))

    from_email = "Cobian Portal <" + settings.EMAIL_NO_REPLY + ">"

    return send_email(email_subject, email_body, emails, from_email)
def _presentation_rep_email(request, to_email, presentation_id, message):
    try:
        data_option = DataOption.objects.get(option_type="PRE-BOOK_TITLE")
        presentation = Presentation.objects.get(pk=presentation_id)
        prebook_title = data_option.value

        data_object = {
            "image_path": settings.EMAIL_STATIC_URL,
            "presentation": presentation,
            "prebook_title": prebook_title,
            "message": message
        }

        from_email = "Cobian Portal <*****@*****.**>"
        email_subject = "{} Revision".format(prebook_title)
        email_body = make_html_email('emails/presentation_rep_email', data_object,
                                     context_instance=RequestContext(request))

        return send_email(email_subject, email_body, to_email, from_email)

    except Exception, e:
        logger.error("_presentation_rep_email: {}".format(e))
        raise e