54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
from utils.email import add_outgoing_email
|
|
import logging
|
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
|
|
|
|
|
def send_creditnote_email(creditnote):
|
|
# put formatdict together
|
|
formatdict = {
|
|
'creditnote': creditnote,
|
|
}
|
|
|
|
subject = 'BornHack creditnote %s' % creditnote.pk
|
|
|
|
# add email to outgoing email queue
|
|
return add_outgoing_email(
|
|
text_template='emails/creditnote_email.txt',
|
|
html_template='emails/creditnote_email.html',
|
|
recipients=creditnote.user.email,
|
|
formatdict=formatdict,
|
|
subject=subject,
|
|
attachment=creditnote.pdf.read(),
|
|
attachment_filename=creditnote.filename
|
|
)
|
|
|
|
|
|
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
|
|
|
|
# add email to outgoing email queue
|
|
return add_outgoing_email(
|
|
text_template='emails/invoice_email.txt',
|
|
html_template='emails/invoice_email.html',
|
|
recipients=invoice.order.user.email,
|
|
formatdict=formatdict,
|
|
subject=subject,
|
|
attachment=invoice.pdf.read(),
|
|
attachment_filename=invoice.filename
|
|
)
|
|
|
|
|
|
def send_test_email(recipient):
|
|
return add_outgoing_email(
|
|
text_template='emails/testmail.txt',
|
|
recipients=recipient,
|
|
subject='testmail from bornhack website'
|
|
)
|