源代码:https://github.com/ltoddy/Python-useful
sendemail.py
import smtplib
from email.mime.text import MIMEText
msg = MIMEText('The body of the email is here') # 这里是你的信件中的内容
msg['From'] = 'ltoddy@163.com' # 这里是发送人的邮箱.
msg['To'] = 'ltoddy@qq.com' # 这里是接收信件人的邮箱
msg['Subject'] = 'an email'