Compare commits

...

2 Commits

1 changed files with 10 additions and 9 deletions

View File

@ -53,15 +53,16 @@ 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")
encoders.encode_base64(part) part.set_payload(attachment.read())
part.add_header( encoders.encode_base64(part)
"Content-Disposition", part.add_header(
f"attachment; filename= {filename}", "Content-Disposition",
) f"attachment; filename= {filename}",
message.attach(part) )
message.attach(part)
text = message.as_string() text = message.as_string()
context = ssl.create_default_context() context = ssl.create_default_context()
try: try: