从 telnet 库返回结果时遇到一些问题,但我得到的只是标题,然后是空白等待输入。
知道如何从 Telnet 获取输出吗?
def smtp_test(server_info):
print "Check server info: " + server_info
cpos = server_info.find(':')
try:
sock = socket()
# sock.connect((server_info[:cpos], int(server_info[cpos+1:])))
sock.connect(("mail.SMTPSERVERNAME.com", 25))
print sock.recv(256)
sock.send("HELO client.example.com\r")
print sock.recv(256)
sock.send("MAIL from: <sender@example.com>\r")
print sock.recv(256)
#sock.send("RCPT to: <recipient@example.com>")
#print sock.recv(256)
sock.close
return True
except:
return False