I trying to get validate_email package (https://pypi.python.org/pypi/validate_email) to verify an email for me on a Windows 7/Python 2.7 device. The following works:
>>> validate_email('example@example.com')
True
>>> validate_email('example@example.com',check_mx=True)
True
>>> validate_email('example@example.com',verify=True)
True
But when I try a commercial email server example to check if the host has SMPT Server and/or the email really exists, it fails as follows:
>>> validate_email('example@gmail.com')
True
>>> validate_email('example@gmail.com',check_mx=True)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\lib\site-packages\validate_email.py", line 104, in validate_email
smtp.connect(mx[1])
File "C:\Python27\lib\smtplib.py", line 309, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python27\lib\smtplib.py", line 284, in _get_socket
return socket.create_connection((port, host), timeout)
File "C:\Python27\lib\socket.py", line 571, in create_connection
raise err
error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
>>> validate_email('example@gmail.com',verify=True)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python27\lib\site-packages\validate_email.py", line 104, in validate_email
smtp.connect(mx[1])
File "C:\Python27\lib\smtplib.py", line 309, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python27\lib\smtplib.py", line 284, in _get_socket
return socket.create_connection((port, host), timeout)
File "C:\Python27\lib\socket.py", line 571, in create_connection
raise err
error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
It appears that I'm trying to access a port that I don't have permission to, but I don't know how to change to a port that would work and has the correct permissions.
Any suggestions?