Created
September 3, 2022 11:35
-
-
Save samirsaci/e5e8fb5394b353e12dc6e67f1f8e577c to your computer and use it in GitHub Desktop.
Mail Report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Open the visual | |
| with open(file_img, 'rb') as fp: | |
| img = MIMEImage(fp.read()) | |
| img.add_header('Content-Disposition', 'attachment', filename=file_img) | |
| img.add_header('X-Attachment-Id', '0') | |
| img.add_header('Content-ID', '<0>') | |
| fp.close() | |
| msg.attach(img) | |
| # Open the header | |
| with open(file_header, 'rb') as fp: | |
| img = MIMEImage(fp.read()) | |
| img.add_header('Content-Disposition', 'attachment', filename=file_header) | |
| img.add_header('X-Attachment-Id', '1') | |
| img.add_header('Content-ID', '<1>') | |
| fp.close() | |
| msg.attach(img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment