Python Sending Excel Attachment corrupts file

Viewed 152

Using the ezgmail library, I am sending an E-mail with an Excel file attached.

I am able to send the E-mail with the attached Excel file, but when I open the Excel file from the sent E-mail, it seems it becomes corrupt for some reason because I get this message:

We found a problem with some content in 'attached_file.xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

When I click "Yes" I get:

Excel cannot open the file 'attached_file.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

The excel file that I attach opens fine from my desktop, or if I E-mail it manually. I get these prompts only after E-mailing it via my python script which leverages ezgmail. Does anyone have ideas?

0 Answers
Related