I am creating a python script that uses our company's office 365 email domain to send emails.
However, I cannot establish a connection.
import smtplib
mailserver = smtplib.SMTP('smtp.office365.com',535, timeout=120)
mailserver.ehlo()
mailserver.starttls()
mailserver.login('user@company.com','Password')
mailserver.sendmail('another.user@company.com')
mailserver.quit()
The error I am getting is:
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I have absolutely no idea where I am going wrong. After reviewing the documentation it my code seems perfect.
Any input is greatly appreciated!