The tool can now update the payment history.

This commit is contained in:
JohnKent
2019-07-10 22:57:23 -04:00
parent e9fefb1a1a
commit 717210636d
4 changed files with 150 additions and 63 deletions

View File

@@ -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: