Avatar ·

SMTPLIB in Python with smtp.yandex.ru

📁 python, вопрос, пример, работа

I use Python 3.4.3. I want to write a simple script that will send text information to the given box. Found :. In the interpreter mode I introduce:

   & gt; & gt; & gt;   Import  smtplib  & gt; & gt; & gt;  Server = SMTPLIB.SMTP (,  465 )     

and the interpreter hungs tightly. For Yandex, the info about the server took.

UPD: if you use the same for Gmail:

  server = smtplib.smtp ( 'smtp.gmail.com' ,  587 )     

all the norms. However, I would like (i.e. there is a box) to connect to Yandex. Perhaps this is?

upd2: If you use port 587 for Yandex, then the second line also passes. However, the third:

  server.login (,  "" Password "" )     

leads to raising exepshen smtpserverdisconnected

udp3: found. I do this:

   import  smtplibsmtp = smtplib.smtp_ssl () smtp.connect ( 'smtp.yandex.ru' )     

and falling out ssl.ssleoferror

upd4: found and did this:

  Server = "" smtplib.smtp_ssl ( 'smtp.yandex.ru:465'  daserver.login(<' login ',  'Pass' )     

and everything worked. It eaed in the sense that it came smtplib.smtpouthenticationerror with a message, the essence of which is that I behave like a robot and I need to tie a mobile number so that the system has ceased to see a robot in me. Apparently, protection against password selection.