#!/usr/bin/python
import smtplib
import string
HOST = "mail.merit-link.com"
SUBJECT = "Test email from Python"
TO = "[email protected]"
FROM = "[email protected]"
text = "Python rules them all!"
BODY = string.join((
"From: %s" %FROM,
"TO: %s" %TO,
"Subject: %s" %SUBJECT,
"",
text
),"\r\n")
server = smtplib.SMTP()
server.connect(HOST,"25")
server.login("yaosx","mypasswd") #注意此处是登录的用户名和密码
server.sendmail(FROM,[TO],BODY)
server.quit()
时间: 2024-11-05 20:30:34