Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python smtplib login error smtplib.SMTPException: STARTTLS extension not supported by server

I am trying to connect with my company's email server using smtplib in python Below is my code snippet:

server = smtplib.SMTP('mail.mycompany.com',25)
server.ehlo()        
server.starttls()
server.login('[email protected]', 'my_password')

When I run my code I get the following error:

smtplib.SMTPException: STARTTLS extension not supported by server.

After searching this error on google i found that my company's smtp server does not support starttls authentication so i have to remove server.starttls() this line from my code but when i remove this line I get following error:

smtplib.SMTPException: SMTP AUTH extension not supported by server.

I have spent whole day to search these errors but didn't find any solution.

like image 898
Husnain Taseer Avatar asked Nov 09 '15 07:11

Husnain Taseer


Video Answer


1 Answers

Probably, you don't need to login to the server. I don't have to when I connect to my corporate SMTP server. So you could try something like:

server = smtplib.SMTP('mail.mycompany.com',25)
server.ehlo()        
server.sendmail('[email protected]', '[email protected]', msg)
like image 194
yeniv Avatar answered Sep 28 '22 20:09

yeniv