示例#1
0
def notify_new_contact_request_email(contact_request):
    contact_request = clean_instance(contact_request, ContactRequest)

    if contact_request.body:
        merge_vars = [
            mandrill_utils.create_merge_var('full_name',
                                            contact_request.fullname),
            mandrill_utils.create_merge_var('email', contact_request.email),
            mandrill_utils.create_merge_var('message', contact_request.body),
        ]

        mandrill_utils.send_email('73_Platform-guest-emails',
                                  TUNGA_CONTACT_REQUEST_EMAIL_RECIPIENTS,
                                  merge_vars=merge_vars)
    else:
        subject = "New {} Request".format(contact_request.item and 'Offer'
                                          or 'Contact')
        msg_suffix = 'wants to know more about Tunga.'
        if contact_request.item:
            item_name = contact_request.get_item_display()
            subject = '%s (%s)' % (subject, item_name)
            msg_suffix = 'requested for "%s"' % item_name
        to = TUNGA_CONTACT_REQUEST_EMAIL_RECIPIENTS

        ctx = {
            'email': contact_request.email,
            'message': '%s %s ' % (contact_request.email, msg_suffix)
        }

        if send_mail(subject, 'tunga/email/contact_request_message', to, ctx):
            contact_request.email_sent_at = datetime.datetime.utcnow()
            contact_request.save()
示例#2
0
def notify_paid_invoice_email_dev(invoice):
    invoice = clean_instance(invoice, Invoice)

    if invoice.legacy_id or invoice.type != INVOICE_TYPE_PURCHASE or not invoice.paid:
        # ignore legacy invoices and only notify about developer invoices
        return

    to = [invoice.user.email]

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, invoice.user.first_name),
        mandrill_utils.create_merge_var('payout_title', invoice.full_title),
    ]

    pdf_file_contents = base64.b64encode(invoice.pdf)

    attachments = [
        dict(
            content=pdf_file_contents,
            name='Invoice - {}.pdf'.format(invoice.full_title),
            type='application/pdf'
        )
    ]

    mandrill_utils.send_email('87-payout-made', to, merge_vars=merge_vars, attachments=attachments)
示例#3
0
def notify_payment_link_client_email(instance):
    instance = clean_instance(instance, Task)

    to = [instance.user.email]
    if instance.owner and instance.owner.email != instance.user.email:
        to.append(instance.owner.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.id)
    payment_link = '{}pay/'.format(task_url)

    owner = instance.owner or instance.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        owner.first_name),
        mandrill_utils.create_merge_var('payment_title', instance.summary),
        mandrill_utils.create_merge_var('payment_link', payment_link),
    ]

    mandrill_response = mandrill_utils.send_email('70-payment-link-ready',
                                                  to,
                                                  merge_vars=merge_vars)
    if mandrill_response:
        instance.payment_link_sent = True
        instance.payment_link_sent_at = datetime.datetime.utcnow()
        instance.save()

        mandrill_utils.log_emails.delay(mandrill_response,
                                        to,
                                        deal_ids=[instance.hubspot_deal_id])
示例#4
0
def notify_payment_link_client_email(instance):
    instance = clean_instance(instance, Task)

    to = [instance.user.email]
    if instance.owner and instance.owner.email != instance.user.email:
        to.append(instance.owner.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.id)
    payment_link = '{}pay/'.format(task_url)

    owner = instance.owner or instance.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, owner.first_name),
        mandrill_utils.create_merge_var('payment_title', instance.summary),
        mandrill_utils.create_merge_var('payment_link', payment_link),
    ]

    mandrill_response = mandrill_utils.send_email('70-payment-link-ready', to, merge_vars=merge_vars)
    if mandrill_response:
        instance.payment_link_sent = True
        instance.payment_link_sent_at = datetime.datetime.utcnow()
        instance.save()

        mandrill_utils.log_emails.delay(mandrill_response, to, deal_ids=[instance.hubspot_deal_id])
示例#5
0
def notify_paid_invoice_email_dev(invoice):
    invoice = clean_instance(invoice, Invoice)

    if invoice.legacy_id or invoice.type != INVOICE_TYPE_PURCHASE or not invoice.paid:
        # ignore legacy invoices and only notify about developer invoices
        return

    to = [invoice.user.email]

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        invoice.user.first_name),
        mandrill_utils.create_merge_var('payout_title', invoice.full_title),
    ]

    pdf_file_contents = base64.b64encode(invoice.pdf)

    attachments = [
        dict(content=pdf_file_contents,
             name='Invoice - {}.pdf'.format(invoice.full_title),
             type='application/pdf')
    ]

    mandrill_utils.send_email('87-payout-made',
                              to,
                              merge_vars=merge_vars,
                              attachments=attachments)
示例#6
0
def notify_new_task_invoice_client_email(instance):
    instance = clean_instance(instance, TaskInvoice)

    to = [instance.user.email]
    if instance.task.owner and instance.task.owner.email != instance.user.email:
        to.append(instance.task.owner.email)

    if instance.task.user and instance.task.user.email != instance.user.email:
        to.append(instance.task.user.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.task.id)

    owner = instance.task.owner or instance.task.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        owner.first_name),
        mandrill_utils.create_merge_var('invoice_title',
                                        instance.task.summary),
        mandrill_utils.create_merge_var(
            'can_pay',
            bool(instance.payment_method != TASK_PAYMENT_METHOD_BANK
                 and not instance.task.payment_approved)),
    ]

    rendered_html = process_invoices(instance.task.id,
                                     invoice_types=('client', ),
                                     user_id=owner.id,
                                     is_admin=False)
    pdf_file = HTML(string=rendered_html, encoding='utf-8').write_pdf()
    pdf_file_contents = base64.b64encode(pdf_file)

    attachments = [
        dict(content=pdf_file_contents,
             name='Invoice - {}'.format(instance.task.summary),
             type='application/pdf')
    ]

    mandrill_response = mandrill_utils.send_email('69-invoice',
                                                  to,
                                                  merge_vars=merge_vars,
                                                  attachments=attachments)
    if mandrill_response:
        mandrill_utils.log_emails.delay(
            mandrill_response, to, deal_ids=[instance.task.hubspot_deal_id])

        # Notify via Slack of sent email to double check and prevent multiple sends
        slack_utils.send_incoming_webhook(
            SLACK_DEBUGGING_INCOMING_WEBHOOK, {
                slack_utils.KEY_TEXT:
                "Mandrill Email sent to {} for <{}|Invoice: {}>".format(
                    ', '.join(to), task_url, instance.task.summary),
                slack_utils.KEY_CHANNEL:
                '#alerts'
            })
示例#7
0
def notify_updated_invoice_email_client(invoice):
    invoice = clean_instance(invoice, Invoice)

    today_end = datetime.datetime.utcnow().replace(hour=23,
                                                   minute=59,
                                                   second=59,
                                                   microsecond=999999)

    if (not invoice.legacy_id) and invoice.type == INVOICE_TYPE_SALE and \
        invoice.issued_at <= today_end and invoice.last_sent_at and not invoice.paid:
        # only notify updates to non-legacy client invoices that are already due and have been sent before

        invoice_user_email = invoice.user.invoice_email or invoice.user.email
        to = [invoice_user_email]
        if invoice.project.owner:
            invoice_owner_email = invoice.project.owner.invoice_email or invoice.project.owner.email
            if invoice_owner_email != invoice_user_email:
                to.append(invoice_owner_email)

        if invoice.project.user:
            project_user_email = invoice.project.user.invoice_email or invoice.project.user.email
            if project_user_email != invoice_user_email:
                to.append(project_user_email)

        payment_link = '{}/projects/{}/pay'.format(TUNGA_URL,
                                                   invoice.project.id)

        merge_vars = [
            mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                            invoice.user.first_name),
            mandrill_utils.create_merge_var('invoice_title',
                                            invoice.full_title),
            mandrill_utils.create_merge_var('payment_link', payment_link),
        ]

        pdf_file_contents = base64.b64encode(invoice.credit_note_pdf)

        attachments = [
            dict(content=pdf_file_contents,
                 name='Credit note for Invoice - {}.pdf'.format(
                     invoice.full_title),
                 type='application/pdf')
        ]

        mandrill_response = mandrill_utils.send_email('88-invoice-update',
                                                      to,
                                                      merge_vars=merge_vars,
                                                      attachments=attachments)
        if mandrill_response:
            invoice.last_sent_at = datetime.datetime.utcnow()
            invoice.save()

            mandrill_utils.log_emails.delay(mandrill_response, to)
示例#8
0
def notify_new_invoice_email_dev(invoice):
    invoice = clean_instance(invoice, Invoice)

    if invoice.legacy_id or invoice.type != INVOICE_TYPE_PURCHASE:
        # ignore legacy invoices and only notify about developer invoices
        return

    to = [invoice.user.email]

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, invoice.user.first_name),
        mandrill_utils.create_merge_var('payout_title', invoice.full_title),
        mandrill_utils.create_merge_var('payout_date', DateFormat(invoice.issued_at).format('l, jS F, Y')),
    ]

    mandrill_utils.send_email('86-payout-update', to, merge_vars=merge_vars)
示例#9
0
def notify_new_invoice_email_client(invoice):
    invoice = clean_instance(invoice, Invoice)

    today_end = datetime.datetime.utcnow().replace(hour=23, minute=59, second=59, microsecond=999999)

    if (not invoice.legacy_id) and invoice.type == INVOICE_TYPE_SALE and \
        invoice.issued_at <= today_end and not invoice.last_sent_at and not invoice.paid:

        # only notify about non-legacy client invoices that are already due and haven't been sent yet

        invoice_user_email = invoice.user.invoice_email or invoice.user.email
        to = [invoice_user_email]
        if invoice.project.owner:
            invoice_owner_email = invoice.project.owner.invoice_email or invoice.project.owner.email
            if invoice_owner_email != invoice_user_email:
                to.append(invoice_owner_email)

        if invoice.project.user:
            project_user_email = invoice.project.user.invoice_email or invoice.project.user.email
            if project_user_email != invoice_user_email:
                to.append(project_user_email)

        payment_link = '{}/projects/{}/pay'.format(TUNGA_URL, invoice.project.id)

        merge_vars = [
            mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, invoice.user.first_name),
            mandrill_utils.create_merge_var('project_title', invoice.full_title),
            mandrill_utils.create_merge_var('payment_link', payment_link),
        ]

        pdf_file_contents = base64.b64encode(invoice.pdf)

        attachments = [
            dict(
                content=pdf_file_contents,
                name='Invoice - {}.pdf'.format(invoice.full_title),
                type='application/pdf'
            )
        ]

        mandrill_response = mandrill_utils.send_email('83-invoice-email', to, merge_vars=merge_vars, attachments=attachments)
        if mandrill_response:
            invoice.last_sent_at = datetime.datetime.utcnow()
            invoice.save()

            mandrill_utils.log_emails.delay(mandrill_response, to)
示例#10
0
def notify_interest_poll_email(interest_poll, reminder=False):
    interest_poll = clean_instance(interest_poll, InterestPoll)

    to = [interest_poll.user.email]

    poll_url = '{}/poll/{}/{}'.format(TUNGA_URL, interest_poll.id, interest_poll.token)

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, interest_poll.user.first_name),
        mandrill_utils.create_merge_var('opportunity_title', interest_poll.project.title),
        mandrill_utils.create_merge_var('skills', str(interest_poll.project.skills)),
        mandrill_utils.create_merge_var('description', interest_poll.project.description),
        mandrill_utils.create_merge_var('scope', interest_poll.project.get_expected_duration_display()),
        mandrill_utils.create_merge_var('yes_url', '{}?status=interested'.format(poll_url)),
        mandrill_utils.create_merge_var('no_url', '{}?status=uninterested'.format(poll_url)),
    ]

    mandrill_response = mandrill_utils.send_email(
        reminder and '90-availability-for-project-reminder' or '89-availability-for-project',
        to, merge_vars=merge_vars
    )
    if mandrill_response:
        if reminder:
            interest_poll.reminded_at = datetime.datetime.utcnow()
        else:
            interest_poll.sent_at = datetime.datetime.utcnow()
        interest_poll.save()

        mandrill_utils.log_emails.delay(mandrill_response, to)
示例#11
0
def notify_new_task_invoice_client_email(instance, template_name='69-invoice'):
    instance = clean_instance(instance, TaskInvoice)

    to = [instance.user.email]
    if instance.task.owner and instance.task.owner.email != instance.user.email:
        to.append(instance.task.owner.email)

    if instance.task.user and instance.task.user.email != instance.user.email:
        to.append(instance.task.user.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.task.id)

    owner = instance.task.owner or instance.task.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        owner.first_name),
        mandrill_utils.create_merge_var('invoice_title',
                                        instance.task.summary),
        mandrill_utils.create_merge_var(
            'can_pay',
            bool(instance.payment_method != PAYMENT_METHOD_BANK
                 and not instance.task.payment_approved)),
    ]

    rendered_html = process_invoices(instance.task.id,
                                     invoice_types=('client', ),
                                     user_id=owner.id,
                                     is_admin=False)
    pdf_file = HTML(string=rendered_html, encoding='utf-8').write_pdf()
    pdf_file_contents = base64.b64encode(pdf_file)

    attachments = [
        dict(content=pdf_file_contents,
             name='Invoice - {}.pdf'.format(instance.task.summary),
             type='application/pdf')
    ]

    mandrill_response = mandrill_utils.send_email(template_name,
                                                  to,
                                                  merge_vars=merge_vars,
                                                  attachments=attachments)
    if mandrill_response:
        mandrill_utils.log_emails.delay(
            mandrill_response, to, deal_ids=[instance.task.hubspot_deal_id])
示例#12
0
def notify_new_invoice_email_dev(invoice):
    invoice = clean_instance(invoice, Invoice)

    if invoice.legacy_id or invoice.type != INVOICE_TYPE_PURCHASE:
        # ignore legacy invoices and only notify about developer invoices
        return

    to = [invoice.user.email]

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        invoice.user.first_name),
        mandrill_utils.create_merge_var('payout_title', invoice.full_title),
        mandrill_utils.create_merge_var(
            'payout_date',
            DateFormat(invoice.issued_at).format('l, jS F, Y')),
    ]

    mandrill_utils.send_email('86-payout-update', to, merge_vars=merge_vars)
示例#13
0
def notify_new_task_client_drip_one(instance, template='welcome'):
    instance = clean_instance(instance, Task)

    if instance.source != TASK_SOURCE_NEW_USER:
        # Only target wizard users
        return False

    to = [instance.user.email]
    if instance.owner:
        to.append(instance.owner.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.id)
    task_edit_url = '{}/task/{}/edit/complete-task/'.format(
        TUNGA_URL, instance.id)
    task_call_url = '{}/task/{}/edit/call/'.format(TUNGA_URL, instance.id)
    browse_url = '{}/people/filter/developers'.format(TUNGA_URL)

    if not instance.user.is_confirmed:
        url_prefix = '{}/reset-password/confirm/{}/{}?new_user=true&next='.format(
            TUNGA_URL, instance.user.uid, instance.user.generate_reset_token())
        task_url = '{}{}'.format(url_prefix, task_url)
        task_edit_url = '{}{}'.format(url_prefix, task_edit_url)
        task_call_url = '{}{}'.format(url_prefix, task_call_url)
        browse_url = '{}{}'.format(url_prefix, browse_url)

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        instance.user.first_name),
        mandrill_utils.create_merge_var('task_url', task_edit_url),
        mandrill_utils.create_merge_var('call_url', task_call_url),
        mandrill_utils.create_merge_var('browse_url', browse_url)
    ]

    template_code = None
    if template == 'welcome':
        if instance.schedule_call_start:
            template_code = '01-b-welcome-call-scheduled'
            merge_vars.extend([
                mandrill_utils.create_merge_var(
                    'date',
                    instance.schedule_call_start.strftime("%d %b, %Y")),
                mandrill_utils.create_merge_var(
                    'time', instance.schedule_call_start.strftime("%I:%M%p")),
            ])
        else:
            template_code = '01-welcome-new'
    elif template == 'hiring':
        template_code = '02-hiring'

    if template_code:
        mandrill_response = mandrill_utils.send_email(template_code,
                                                      to,
                                                      merge_vars=merge_vars)
        if mandrill_response:
            instance.last_drip_mail = template
            instance.last_drip_mail_at = datetime.datetime.utcnow()
            instance.save()

            mandrill_utils.log_emails.delay(
                mandrill_response, to, deal_ids=[instance.hubspot_deal_id])
示例#14
0
def notify_payment_link_client_email(instance):
    instance = clean_instance(instance, Task)

    to = [instance.user.email]
    if instance.owner and instance.owner.email != instance.user.email:
        to.append(instance.owner.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.id)
    payment_link = '{}pay/'.format(task_url)

    owner = instance.owner or instance.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        owner.first_name),
        mandrill_utils.create_merge_var('payment_title', instance.summary),
        mandrill_utils.create_merge_var('payment_link', payment_link),
    ]

    mandrill_response = mandrill_utils.send_email('70-payment-link-ready',
                                                  to,
                                                  merge_vars=merge_vars)
    if mandrill_response:
        instance.payment_link_sent = True
        instance.payment_link_sent_at = datetime.datetime.utcnow()
        instance.save()

        mandrill_utils.log_emails.delay(mandrill_response,
                                        to,
                                        deal_ids=[instance.hubspot_deal_id])

        # Notify via Slack of sent email to double check and prevent multiple sends
        slack_utils.send_incoming_webhook(
            SLACK_DEBUGGING_INCOMING_WEBHOOK, {
                slack_utils.KEY_TEXT:
                "Mandrill Email sent to {} for <{}|Payment Link: {}>".format(
                    ', '.join(to), task_url, instance.summary),
                slack_utils.KEY_CHANNEL:
                '#alerts'
            })
示例#15
0
def notify_new_task_invoice_client_email(instance, template_name='69-invoice'):
    instance = clean_instance(instance, TaskInvoice)

    to = [instance.user.email]
    if instance.task.owner and instance.task.owner.email != instance.user.email:
        to.append(instance.task.owner.email)

    if instance.task.user and instance.task.user.email != instance.user.email:
        to.append(instance.task.user.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.task.id)

    owner = instance.task.owner or instance.task.user

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, owner.first_name),
        mandrill_utils.create_merge_var('invoice_title', instance.task.summary),
        mandrill_utils.create_merge_var(
            'can_pay',
            bool(instance.payment_method != PAYMENT_METHOD_BANK and not instance.task.payment_approved)
        ),
    ]

    rendered_html = process_invoices(instance.task.id, invoice_types=('client',), user_id=owner.id, is_admin=False)
    pdf_file = HTML(string=rendered_html, encoding='utf-8').write_pdf()
    pdf_file_contents = base64.b64encode(pdf_file)

    attachments = [
        dict(
            content=pdf_file_contents,
            name='Invoice - {}.pdf'.format(instance.task.summary),
            type='application/pdf'
        )
    ]

    mandrill_response = mandrill_utils.send_email(template_name, to, merge_vars=merge_vars, attachments=attachments)
    if mandrill_response:
        mandrill_utils.log_emails.delay(mandrill_response, to, deal_ids=[instance.task.hubspot_deal_id])
示例#16
0
def notify_new_task_client_drip_one(instance, template='welcome'):
    instance = clean_instance(instance, Task)

    if instance.source != TASK_SOURCE_NEW_USER:
        # Only target wizard users
        return False

    to = [instance.user.email]
    if instance.owner:
        to.append(instance.owner.email)

    task_url = '{}/task/{}/'.format(TUNGA_URL, instance.id)
    task_edit_url = '{}/task/{}/edit/complete-task/'.format(TUNGA_URL, instance.id)
    task_call_url = '{}/task/{}/edit/call/'.format(TUNGA_URL, instance.id)
    browse_url = '{}/people/filter/developers'.format(TUNGA_URL)

    if not instance.user.is_confirmed:
        url_prefix = '{}/reset-password/confirm/{}/{}?new_user=true&next='.format(
            TUNGA_URL, instance.user.uid, instance.user.generate_reset_token()
        )
        task_url = '{}{}'.format(url_prefix, task_url)
        task_edit_url = '{}{}'.format(url_prefix, task_edit_url)
        task_call_url = '{}{}'.format(url_prefix, task_call_url)
        browse_url = '{}{}'.format(url_prefix, browse_url)

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME, instance.user.first_name),
        mandrill_utils.create_merge_var('task_url', task_edit_url),
        mandrill_utils.create_merge_var('call_url', task_call_url),
        mandrill_utils.create_merge_var('browse_url', browse_url)
    ]

    template_code = None
    if template == 'welcome':
        if instance.schedule_call_start:
            template_code = '01-b-welcome-call-scheduled'
            merge_vars.extend(
                [
                    mandrill_utils.create_merge_var('date', instance.schedule_call_start.strftime("%d %b, %Y")),
                    mandrill_utils.create_merge_var('time', instance.schedule_call_start.strftime("%I:%M%p")),
                ]
            )
        else:
            template_code = '01-welcome-new'
    elif template == 'hiring':
        template_code = '02-hiring'

    if template_code:
        mandrill_response = mandrill_utils.send_email(template_code, to, merge_vars=merge_vars)
        if mandrill_response:
            instance.last_drip_mail = template
            instance.last_drip_mail_at = datetime.datetime.utcnow()
            instance.save()

            mandrill_utils.log_emails.delay(mandrill_response, to, deal_ids=[instance.hubspot_deal_id])
示例#17
0
def notify_interest_poll_email(interest_poll, reminder=False):
    interest_poll = clean_instance(interest_poll, InterestPoll)

    to = [interest_poll.user.email]

    poll_url = '{}/poll/{}/{}'.format(TUNGA_URL, interest_poll.id,
                                      interest_poll.token)

    merge_vars = [
        mandrill_utils.create_merge_var(MANDRILL_VAR_FIRST_NAME,
                                        interest_poll.user.first_name),
        mandrill_utils.create_merge_var('opportunity_title',
                                        interest_poll.project.title),
        mandrill_utils.create_merge_var('skills',
                                        str(interest_poll.project.skills)),
        mandrill_utils.create_merge_var('description',
                                        interest_poll.project.description),
        mandrill_utils.create_merge_var(
            'scope', interest_poll.project.get_expected_duration_display()),
        mandrill_utils.create_merge_var(
            'yes_url', '{}?status=interested'.format(poll_url)),
        mandrill_utils.create_merge_var(
            'no_url', '{}?status=uninterested'.format(poll_url)),
    ]

    mandrill_response = mandrill_utils.send_email(
        reminder and '90-availability-for-project-reminder'
        or '89-availability-for-project',
        to,
        merge_vars=merge_vars)
    if mandrill_response:
        if reminder:
            interest_poll.reminded_at = datetime.datetime.utcnow()
        else:
            interest_poll.sent_at = datetime.datetime.utcnow()
        interest_poll.save()

        mandrill_utils.log_emails.delay(mandrill_response, to)