Python脚本实现发送邮件功能

脚本如下:



#!/usr/bin/env  python
import  smtplib
import  string
FROM="[email protected]"
TO="[email protected]"
PASS="yjl520105"
HOST="smtp.163.com"
PORT="25"
SUBJECT="Hello  Python"
TEXT="Please  check  all  host!"
BODY= string.join((
        "From: %s" % FROM,
        "To: %s" % TO,
        "Subject: %s" % SUBJECT,
        "",
        TEXT
), "\r\n")
server=smtplib.SMTP()
server.connect(HOST,"25")
server.login(FROM,PASS)
server.sendmail(FROM,TO,BODY)
server.quit()


你可能感兴趣的:(python,smtp)