我的代碼如何從蟒蛇
import smtplib
import socket
import sys
from email.mime.text import MIMEText
fp = open("CR_new.txt", 'r')
msg = MIMEText(fp.read())
fp.close()
you = "[email protected]"
me = "[email protected]"
msg['Subject'] = 'The contents of %s' % "CR_new.txt"
msg['From'] = you
msg['To'] = me
s = smtplib.SMTP('127.0.0.1')
s.sendmail(you,me, msg.as_string())
s.quit()
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
注發送電子郵件:
- 沒有一個SMTP服務器
你有一個SMTP服務器上的本地主機上運行? –
我不這麼認爲,我正在使用Windows 7 – RajivKumar
然後你需要一個SMTP服務器(你自己或任何其他你有一個帳戶)。 –