On Fri Dec 26 2014 at 11:07:30 PM MRAB <pyt...@mrabarnett.plus.com> wrote: According to the docs, if you let the port parameter default to 0, it'll use port 465.
I tested with my ISP. Using port 465, it failed. Using the default, it succeeded. So, I changed the code how you said, but still not working. Code: import smtplib fromaddr = 'mksfjnsfji4433j4...@bk.ru' toaddrs = ['mksfjnsfji4433j4...@bk.ru'] msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs))) msg = msg + 'test' server = smtplib.SMTP('smtp.mail.ru') server.set_debuglevel(1) server.sendmail(fromaddr, toaddrs, msg) server.quit() Traceback: send: 'ehlo [192.168.0.107]\r\n' reply: b'250-smtp15.mail.ru\r\n' reply: b'250-SIZE 73400320\r\n' reply: b'250-8BITMIME\r\n' reply: b'250-PIPELINING\r\n' reply: b'250-AUTH PLAIN LOGIN XOAUTH2\r\n' reply: b'250 STARTTLS\r\n' reply: retcode (250); Msg: b'smtp15.mail.ru\nSIZE 73400320\n8BITMIME\nPIPELINING\nAUTH PLAIN LOGIN XOAUTH2\nSTARTTLS' send: 'mail FROM:<mksfjnsfji4433j4...@bk.ru> size=70\r\n' reply: b'250 2.0.0 OK\r\n' reply: retcode (250); Msg: b'2.0.0 OK' send: 'rcpt TO:<mksfjnsfji4433j4...@bk.ru>\r\n' reply: b'550 SMTP is available only with SSL or TLS connection enabled.\r\n' reply: retcode (550); Msg: b'SMTP is available only with SSL or TLS connection enabled.' send: 'rset\r\n' Traceback (most recent call last): File ".\test.py", line 13, in <module> server.sendmail(fromaddr, toaddrs, msg) File "C:\Python34\lib\smtplib.py", line 793, in sendmail raise SMTPRecipientsRefused(senderrs) smtplib.SMTPRecipientsRefused: {'mksfjnsfji4433j4...@bk.ru': (550, b'SMTP is available only with SSL or TLS connection e nabled.')}
-- https://mail.python.org/mailman/listinfo/python-list