Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29898

python programming to send an email - ConnectionRefusedError: [WinError 10061] No connection could be made

$
0
0

I'm new to programming .recently I was trying to learn how to send an email using Python on Windows 10.but there were some problems and I don't know what does this error mean. Could someone help me? here is my code :

from email.mime.text import MIMEText
import smtplib
msg=MIMEText("<h1>a heading</h1><p>hellothere!</p>","html")
msg['subject']='a test html message'
msg['from']='<mohammedbehjooarchich@gmail.com>'
msg['to']='<mohammedbehjooarchich@gmail.com>'
s=smtplib.SMTP('127.0.0.1')
s.sendmail('<mohammedbehjooarchich@gmail.com',['<mohammedbehjooarchich@gmail.com'],msg.as_string())
print('message sent')

Viewing all articles
Browse latest Browse all 29898

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>