Oct-02-2016, 08:44 PM
hi
i want to send an email from my python program
i had write this code for doing that:
can you help me.
myself think that my mistake is in line 5.
thank you
i want to send an email from my python program
i had write this code for doing that:
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText print("1") server = smtplib.SMTP('smtp.mail.yahoo.com',465) #smtp,port number print("2") server.ehlo() server.starttls() server.ehlo() server.login("[email protected]","my password") fromaddr = "[email protected]" toaddr = "[email protected]" subject = "From Python" msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = subject print("3") body = "Sent from Python" msg.attach(MIMEText(body, 'plain')) text = msg.as_string() server.sendmail(fromaddr, toaddr, text) print('ok')but it doesnt work.
can you help me.
myself think that my mistake is in line 5.
thank you