[root@localhost python]# cat smtp.py import smtplibimport stringfrom email.mime.text import MIMETextHOST = "smtp-mail.outlook.com"FROM = "bp1260647530@outlook.com"SUBJECT = "this is a test"TO = "1260647530@qq.com"TEXT = "good to see you"BODY = string.join(("from: %s" % FROM,"to: %s" % TO,"Subject: %s" % SUBJECT, "",TEXT),"\r\n")server=smtplib.SMTP()server.connect(HOST,"25") #这个端口貌似不对,不过好像没影响server.starttls()server.login("bp1260647530@outlook.com","我的密码")server.sendmail(FROM,TO,BODY)server.close()[root@localhost python]#
查看邮箱,接受正常
本来想用QQ邮箱做实验,结果发现需要万恶的授权码,果断弃用,改用outlook邮箱,这个邮箱就没有这么流氓