import smtplib
server=smtplib.SMTP('smtp.yandex.com',465)
server.starttls()
server.login('admin@cbitcse.cf','XXXXX')
message='hurray'
server.sendmail('admin@cbitcse.cf','xyz@gmail.com',message)
server.quit()
print('E-mail successfully sent!')
Note: Here .cf is a free domain.I have got a free domain-based email address(admin@cbitcse.ml) with yandex.
Why is this code not working? Any configuration settings needs to changed in yandex account?
For Yandex mail service, STARTTLS is also not working for me. Replace this one
server=smtplib.SMTP('smtp.yandex.com',465)
server.starttls()
with
server=smtplib.SMTP_SSL('smtp.yandex.com',465)