Python3 发送SMTP邮件
erhuabushuo
posted @ 2012年2月19日 20:33
in Python
, 1377 阅读
#!/usr/bin/env python3 import smtplib import time from email.mime.text import MIMEText msg = MIMEText("Hello!") msg['Subject'] = "Hi!" msg['From'] = 'sisl@mail.yht.com' msg['To'] = 'sisl@mail.yht.com' smtp = smtplib.SMTP('192.168.1.125', 25) smtp.ehlo() smtp.login(msg['From'], '382588') smtp.send_message(msg) smtp.quit()