Skip to content

Commit

Permalink
Merge d663c15 into 469e440
Browse files Browse the repository at this point in the history
  • Loading branch information
jsf9k committed May 14, 2019
2 parents 469e440 + d663c15 commit a7abdab
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Expand Up @@ -12,12 +12,6 @@ env:
# Matrix approach here due to: https://github.com/travis-ci/travis-ci/issues/9815
matrix:
include:
- python: 3.4
dist: xenial
sudo: true
- python: 3.5
dist: xenial
sudo: true
- python: 3.6
dist: xenial
sudo: true
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Expand Up @@ -58,8 +58,6 @@ def readme():
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
Expand Down
2 changes: 1 addition & 1 deletion trustymail/__init__.py
@@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import, print_function

__version__ = '0.7.4'
__version__ = '0.7.5'

PublicSuffixListFilename = 'public_suffix_list.dat'
PublicSuffixListReadOnly = False
25 changes: 22 additions & 3 deletions trustymail/trustymail.py
Expand Up @@ -173,9 +173,28 @@ def starttls_scan(domain, smtp_timeout, smtp_localhost, smtp_ports, smtp_cache):
# To get around this I look up the A record and use
# that instead of the hostname in DNS when I call
# smtp_connection.connect().
addr_info = socket.getaddrinfo(
mail_server, port, socket.AF_INET, socket.SOCK_STREAM
)
try:
addr_info = socket.getaddrinfo(
mail_server, port, socket.AF_INET, socket.SOCK_STREAM
)
except socket.gaierror:
# We get this exception if there is no A record
# for the given mail server. This does happen,
# since among their MX records some domains do
# list some IPv6-only mail servers.
#
# Since we can't evaluate such cases we will
# simply log this and give them credit. One of
# the other mail servers will support IPv4.
error_str = f'The mail server {mail_server} does not have an IPv4 address.'
handle_error('[STARTTLS]', domain, error_str)
logging.warn(error_str)
domain.starttls_results[server_and_port]['is_listening'] = True
domain.starttls_results[server_and_port]['supports_smtp'] = True
domain.starttls_results[server_and_port]['starttls'] = True
continue

# Extract the IP address from the socket addrinfo
socket_address = addr_info[0][4]
mail_server_ip_address = socket_address[0]

Expand Down

0 comments on commit a7abdab

Please sign in to comment.