Fix for if cif_data file does not exist

This commit is contained in:
Fred Boniface 2023-06-03 22:03:48 +01:00
parent 4d0538479a
commit 35faea7ecd

View File

@ -53,9 +53,10 @@ def sendMail(msg_body :str):
message['Subject'] = "OwlBoard - dbmanager Logs" message['Subject'] = "OwlBoard - dbmanager Logs"
filename = "cif_data" filename = "cif_data"
message.attach(MIMEText(msg_body, "plain")) message.attach(MIMEText(msg_body, "plain"))
with open(filename, "rb") as attachment: if os.path.exists(filename):
part = MIMEBase("application", "octet-stream") with open(filename, "rb") as attachment:
part.set_payload(attachment.read()) part = MIMEBase("application", "octet-stream")
part.set_payload(attachment.read())
encoders.encode_base64(part) encoders.encode_base64(part)
part.add_header( part.add_header(
"Content-Disposition", "Content-Disposition",