sender = 'warningnetwork@abc.cn'
receiver = 'jack@abc.cn'
subject = 'Warning Network'
smtpserver = 'smtp.abc.com'
username = 'sender@abc.cn'
password = 'sender123'
msg = MIMEText('Hello !This is jack!','plain','utf-8')
#中文需参数‘utf-8’,单字节字符不需要
msg['Subject'] = Header(subject, 'utf-8')
smtp = smtplib.SMTP()
smtp.connect('smtp.abc.com:25')
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
print "邮件发送成功!"
smtp.quit()
receiver = 'jack@abc.cn'
subject = 'Warning Network'
smtpserver = 'smtp.abc.com'
username = 'sender@abc.cn'
password = 'sender123'
msg = MIMEText('Hello !This is jack!','plain','utf-8')
#中文需参数‘utf-8’,单字节字符不需要
msg['Subject'] = Header(subject, 'utf-8')
smtp = smtplib.SMTP()
smtp.connect('smtp.abc.com:25')
smtp.login(username, password)
smtp.sendmail(sender, receiver, msg.as_string())
print "邮件发送成功!"
smtp.quit()