The tool can now update the payment history.
This commit is contained in:
@@ -203,7 +203,7 @@ def amortizeLoan(loan):
|
||||
|
||||
|
||||
def transformTemplate(template_fileName, loanModel):
|
||||
# template_filename = "statement.txt.jinja"
|
||||
# template_filename = "statement.text.jinja"
|
||||
# setup jinja for creating the statement
|
||||
env = Environment(loader=FileSystemLoader('.'))
|
||||
template = env.get_template(template_fileName)
|
||||
@@ -242,6 +242,30 @@ def generateEmail(from_address, to_address, subject, body, pdfAttachment, txtAtt
|
||||
|
||||
return msg
|
||||
|
||||
def generateEmailWithAttachments(from_address, to_address, subject, body, pdfAttachment, htmlAttachment, txtAttachment):
|
||||
msg = MIMEMultipart()
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = from_address
|
||||
msg['To'] = to_address
|
||||
|
||||
msg.attach(MIMEText(body))
|
||||
|
||||
if (pdfAttachment != None):
|
||||
part = MIMEBase("application", "octet-stream")
|
||||
part.set_payload(pdfAttachment)
|
||||
Encoders.encode_base64(part)
|
||||
part.add_header('Content-Disposition', 'attachment; filename="statement.pdf"')
|
||||
msg.attach(part)
|
||||
|
||||
if (txtAttachment != None):
|
||||
part = MIMEBase("text", "html")
|
||||
part.set_payload(txtAttachment)
|
||||
Encoders.encode_base64(part)
|
||||
part.add_header('Content-Disposition', 'attachment; filename="statement.html"')
|
||||
msg.attach(part)
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
def sendEmail(msg, from_address, to_address, passwd):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user