我有一个要通过电子邮件发送的文本文件。我使用以下代码通过 smtplib 发送电子邮件。此代码将附件打印为电子邮件正文。由于我的文本文件有点大,邮件正文中的所有内容都不可见?如何显示电子邮件正文中的所有内容?有什么建议么?
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
msg = MIMEMultipart()
msg['Subject'] = 'ANALYSIS REPORT'
filename = "report.txt"
f = file(filename)
attachment = MIMEText(f.read())
msg.attach(attachment)
smtpObj = smtplib.SMTP('mail.my-domain.com', 25)
smtpObj.sendmail(sender, receivers, msg.as_string())
print "e-mail Successfully Sent!"