Can I use proxy for whole script of python using dns.resolver and smtplib in it? -
import dns.resolver import socket import smtplib import socks
i adding proxy here:
proxy = '196.89.10.16' proxy_port = 8080 socks.setdefaultproxy(socks.proxy_type_socks4, proxy, proxy_port , true) socks.wrapmodule(smtplib)
i getting dns mxrecord:
records = dns.resolver.query('gmail.com', 'mx') mxrecord = records[0].exchange mxrecord = str(mxrecord) print mxrecord server = smtplib.smtp() server.set_debuglevel(0)
connecting mxrecord:
server.connect(mxrecord) server.helo('hello') print server.helo_resp server.mail('example@example.org') addresstoverify = 'example@gmail.com'
i verifying if account exist or not here:
code, message = server.rcpt(str(addresstoverify)) print code print message #returns 250 on success # assume 250 success if code == 250: print('success') else: print('bad')
i want add proxy call rcpt
function.
please help.
Comments
Post a Comment