filename = 'text.txt'
f = file(filename)
attachment = MIMEText(f.read())
attachment.add_header('Content-Disposition', 'attachment', filename=filename)
msg.attach(attachment)
Прикрепите текстовый файл в Python smtplib