Home > other >  Python calls outlook email with multiple attachments
Python calls outlook email with multiple attachments

Time:12-12

Everyone a great god, want to ask, now there is a demand is needed by calling the outlook automatically send mail, need with multiple excel spreadsheet file, I will only send with an attachment, want to ask how should send with multiple excel attachment? Thank you thank you very much, want to add an attachment to 'C: \ \ Users \ \ Administrator \ \ Desktop \ \ email on May 5.1 \ \ \ \ \ \ customers detail 5.4. XLSX'
 import win32com. Client as win32 
The import XLRD

Outlook=win32. Dispatch (' outlook. Application ')
Mail=outlook. The CreateItem (0)
Receivers=['. * * * *]
Cc='[email protected]' + '. '+' [email protected] '
Mail. To=receivers [0]
Mail. Cc=cc
Mail. Subject='attachment for details, please check! '
Workbook=XLRD. Open_workbook (' C: \ \ Users \ \ Administrator \ \ Desktop \ \ \ \ statements online index evaluation \ \ data \ \ email on May 5.1 \ \ \ \ \ \ clinch a deal the subsidiary 5.4 XLSX ')
MySheet=workbook. Sheet_by_index (0)

Nrows=mySheet. Nrows
The content=[]
For I in range (nrows) :
Ss=mySheet. Row_values (I)
Content. append (ss)
Print (content)
Truecontent=STR (content)

Mail. Body="attachment for details, please find!"
E-mail. Attachments. The Add (' C: \ \ Users \ \ Administrator \ \ Desktop \ \ report \ \ inspection \ \ data \ \ email on May 5.1 \ \ \ \ \ \ detail 5.4. XLSX ')
Mail. The Send ()

CodePudding user response:

E-mail. Attachments. The Add
Add 1, continue to add good,
Don't understand, send a mail app, open the XLS came out to show?

CodePudding user response:

E-mail. Attachments. The Add (1 path "files")
E-mail. Attachments. The Add (" file path "2)
That's fine, kiss effective measurement
  • Related