diff --git a/src/mailer.py b/src/mailer.py index 06dd8e9..9a311fd 100644 --- a/src/mailer.py +++ b/src/mailer.py @@ -53,9 +53,10 @@ def sendMail(msg_body :str): message['Subject'] = "OwlBoard - dbmanager Logs" filename = "cif_data" message.attach(MIMEText(msg_body, "plain")) - with open(filename, "rb") as attachment: - part = MIMEBase("application", "octet-stream") - part.set_payload(attachment.read()) + if os.path.exists(filename): + with open(filename, "rb") as attachment: + part = MIMEBase("application", "octet-stream") + part.set_payload(attachment.read()) encoders.encode_base64(part) part.add_header( "Content-Disposition",