smtplib not working as expected

Juan Christian juan0christian at gmail.com
Fri Dec 26 19:39:21 EST 2014


I have the following test code:

import smtplib

fromaddr = 'mksfjnsfji4433j43jc at bk.ru'
toaddrs  = ['mksfjnsfji4433j43jc at bk.ru']

msg = ("From: %s\r\nTo: %s\r\n\r\n"
       % (fromaddr, ", ".join(toaddrs)))

msg = msg + 'test'

print("Message length is " + repr(len(msg)))

server = smtplib.SMTP('smtp.mail.ru', 465)
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

And when I execute it, it keeps running forever and I don't get any email.
What's missing, what's wrong? The smtp server and port are correct -
https://help.mail.ru/enmail-help/mailer/popsmtp

I'm following this tutorial:https://docs.python.org/3/library/smtplib.html

Python 3.4.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141227/3441bf63/attachment.html>


More information about the Python-list mailing list