Loading src/common/mail.py +10 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,16 @@ def send_email(subject, text, files=None): msg.attach(part) else: logger.error(f'Failed to attach file {f}. {f} is not a file.') elif isistance(files, str) and len(files) > 0: if os.path.isfile(files): with open(files, 'rb') as att_file: part = MIMEApplication(att_file.read()) part['Content-Disposition'] = ('attachment; filename=' f'"{os.path.basename(files)}"') msg.attach(part) else: logger.error(f'Failed to attach file {files}. {files} is not a ' 'file.') else: logger.error(f'Failed to attach files "{files}". Please ensure that ' '"files" is passed as type "list"') Loading Loading
src/common/mail.py +10 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,16 @@ def send_email(subject, text, files=None): msg.attach(part) else: logger.error(f'Failed to attach file {f}. {f} is not a file.') elif isistance(files, str) and len(files) > 0: if os.path.isfile(files): with open(files, 'rb') as att_file: part = MIMEApplication(att_file.read()) part['Content-Disposition'] = ('attachment; filename=' f'"{os.path.basename(files)}"') msg.attach(part) else: logger.error(f'Failed to attach file {files}. {files} is not a ' 'file.') else: logger.error(f'Failed to attach files "{files}". Please ensure that ' '"files" is passed as type "list"') Loading