address_book = ['receiver@test.cn'] msg = MIMEMultipart() sender = 'sender@sender.cn' subject = "My subject2222222222222" body = "This is my email body" msg['From'] = sender msg['To'] = ','.join(address_book) msg['Subject'] = subject msg.attach(MIMEText(body, 'plain')) attachment = MIMEBase('application', 'octet-stream') attachment.set_payload(open('\\filepath\2021-08-24.xlsx', 'rb+').read()) encoders.encode_base64(attachment) attachment.add_header('Content-Disposition', 'attachment; filename="1abc.xlsx"') msg.attach(attachment) text = msg.as_string() s = smtplib.SMTP('smtp.smtp.net') s.sendmail(sender, address_book, text) s.quit()