I'm learning to send emails with python. Right at the beginning, I came across error importing the smtplib module methods, which generated this question:
Import error when sending simple email with python
Then I saw that it did not give an import error when typing command by command on the python command line. But another error occurred. These are the commands I type line by line:
from smtplib import SMTP_SSL
server=SMTP_SSL('smtp.live.com',465)
In this second line, the following error occurs:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
server=SMTP_SSL('smtp.live.com',465)
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\smtplib.py", line 1021, in __init__
source_address)
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\smtplib.py", line 335, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\smtplib.py", line 1027, in _get_socket
self.source_address)
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 711, in create_connection
raise err
File "C:\Users\Benedito\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 702, in create_connection
sock.connect(sa)
OSError: [WinError 10013] Foi feita uma tentativa de acesso a um soquete de uma maneira que é proibida pelas permissões de acesso
How do I fix this error? Does anyone have any scrit that works that sends email with python?