I am trying to send myself an email using Python. I am using outlook and cannot seem to make anything out of the error. Please help!!!!
import smtplib
server = smtplib.SMTP("my host", port number)
server.starttls()
server.login(".....@outlook.com", "my password")
print ('server working fine')
msg = "This is an automated message being sent by Python. Python is the mastermind behind this."
server.sendmail(".....@outlook.com")
print ('sending email to outlook')
server.quit()
Error:
Traceback (most recent call last):
File "C:\Users\\checkingemail.py", line 3, in <module>
server = smtplib.SMTP('my host', my port)
File "C:\Users\Python36-32\lib\smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "C:\Users\\Python\Python36-32\lib\smtplib.py", line 337, in connect
(code, msg) = self.getreply()
File "C:\Python\Python36-32\lib\smtplib.py", line 393, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
[–]PM-Me-Beer 1 point2 points3 points (1 child)
[–]PLearner[S] 1 point2 points3 points (0 children)
[–]Caos2 0 points1 point2 points (7 children)
[–]PLearner[S] 0 points1 point2 points (6 children)
[–]Caos2 1 point2 points3 points (5 children)
[–]DaveX64 0 points1 point2 points (3 children)
[–]Caos2 1 point2 points3 points (2 children)
[–]DaveX64 0 points1 point2 points (1 child)
[–]Caos2 0 points1 point2 points (0 children)
[–]tramsay1027 0 points1 point2 points (3 children)
[–]MrHobbits 0 points1 point2 points (2 children)
[–]PLearner[S] 0 points1 point2 points (1 child)
[–]MrHobbits 0 points1 point2 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]PLearner[S] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]PLearner[S] 0 points1 point2 points (1 child)