I have a script that I am currently writing to connect to a host via port 25. Once connected the following code is used to read a text file to gather each user and then issue the VRFY command along with the username. This works really well until I receive no response back from the host, it just hangs there. Towards the bottom of my code I have tried to break out if no response is received but this does not work. I have tried several ways to get it to work without any luck.
Thanks in advance!
with open('usernames.txt') as f:
for users in f:
if users == '':
break
else:
try:
s.send('VRFY ' + users)
result=s.recv(1024)
print result
except socket.timeout:
print IPADDRESS + ' is not responding to VRFY commands'
break