python 2.6.6 smtplib

2023-01-31 02:01:32 python smtplib 2.6

#!/usr/bin/python

import smtplib
import string

HOST = "mail.merit-link.com"
SUBJECT = "Test email from Python"
TO = "yaosx@merit-link.com"
FROM = "yaosx@merit-link.com"
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()




相关文章