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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With