示例#1
0
def send_add_membership_email(membership):
    formatdict = {
        'team': membership.team.name,
        'camp': membership.team.camp.title
    }

    return _send_email(
        text_template='emails/add_membership_email.txt',
        html_template='emails/add_membership_email.html',
        recipient=membership.user.email,
        formatdict=formatdict,
        subject='Team update from {}'.format(membership.team.camp.title)
    )
示例#2
0
def send_creditnote_email(creditnote):
    # put formatdict together
    formatdict = {
        'creditnote': creditnote,
    }

    subject = 'BornHack creditnote %s' % creditnote.pk

    # send mail
    return _send_email(text_template='emails/creditnote_email.txt',
                       html_template='emails/creditnote_email.html',
                       recipient=creditnote.user.email,
                       formatdict=formatdict,
                       subject=subject,
                       attachment=creditnote.pdf.read(),
                       attachment_filename=creditnote.filename)
示例#3
0
def send_new_membership_email(membership):
    formatdict = {
        'team': membership.team.name,
        'camp': membership.team.camp.title
    }

    return _send_email(
        text_template='emails/new_membership_email.txt',
        html_template='emails/new_membership_email.html',
        recipient=[resp.email for resp in membership.team.responsible],
        formatdict=formatdict,
        subject='New membership request for {} at {}'.format(
            membership.team.name,
            membership.team.camp.title
        )
    )
示例#4
0
def send_invoice_email(invoice):
    # put formatdict together
    formatdict = {
        'ordernumber': invoice.order.pk,
        'invoicenumber': invoice.pk,
        'filename': invoice.filename,
    }

    subject = 'BornHack invoice %s' % invoice.pk

    # send mail
    return _send_email(text_template='emails/invoice_email.txt',
                       html_template='emails/invoice_email.html',
                       recipient=invoice.order.user.email,
                       formatdict=formatdict,
                       subject=subject,
                       attachment=invoice.pdf.read(),
                       attachment_filename=invoice.filename)
示例#5
0
def send_remove_membership_email(membership):
    formatdict = {
        'team': membership.team.name,
        'camp': membership.team.camp.title
    }

    if membership.approved:
        text_template = 'emails/remove_membership_email.txt',
        html_template = 'emails/remove_membership_email.html'
    else:
        text_template = 'emails/unapproved_membership_email.txt',
        html_template = 'emails/unapproved_membership_email.html'

    return _send_email(
        text_template=text_template,
        html_template=html_template,
        recipient=membership.user.email,
        formatdict=formatdict,
        subject='Team update from {}'.format(membership.team.camp.title)
    )
示例#6
0
def send_test_email(recipient):
    return _send_email(text_template='emails/testmail.txt',
                       recipient=recipient,
                       subject='testmail from bornhack website')