My-CodeWie E-Mail senden aus Python
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
Hinweis:
- Nicht einen SMTP-Server mit
Haben Sie einen SMTP-Server auf Ihrem lokalen Host ausgeführt haben? –
Ich glaube nicht, ich benutze Windows 7 – RajivKumar
Dann brauchen Sie einen SMTP-Server (Ihr eigenes oder jedes andere Sie haben ein Konto für). –