I am trying to send email from python using smtp and yahoo. is there special settings like gmail in yahoo?
raise SMTPServerDisconnected("Connection unexpectedly closed")
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
server = smtplib.SMTP('smtp.mail.yahoo.com',587) #smtp,port number
server.ehlo()
server.starttls()
server.ehlo()
server.login("[email protected]","mypassword")
fromaddr = "[email protected]"
toaddr = "[email protected]"
subject = "From Python"
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = subject
body = "Sent from Python"
msg.attach(MIMEText(body, 'plain'))
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)I am getting:raise SMTPServerDisconnected("Connection unexpectedly closed")
buran write Jun-19-2021, 06:26 AM:
I removed the attached image because your e-mail and password was visible in the traceback. You may want to change your password.
Also, don't post images of code, error, input, output, etc. Copy/paste as text and using proper tags.
I removed the attached image because your e-mail and password was visible in the traceback. You may want to change your password.
Also, don't post images of code, error, input, output, etc. Copy/paste as text and using proper tags.
