From 8cac24ab066b2bc66bb919f04f31be01753248f5 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 22 Jun 2020 21:59:23 +0500 Subject: [PATCH] add timeout to verify --- emailMarketing/emailMarketing.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/emailMarketing/emailMarketing.py b/emailMarketing/emailMarketing.py index 57a036d9b..ebd5d63a1 100755 --- a/emailMarketing/emailMarketing.py +++ b/emailMarketing/emailMarketing.py @@ -164,7 +164,7 @@ def verificationJob(self): email = items.email self.currentEmail = email domainName = email.split('@')[1] - records = DNS.dnslookup(domainName, 'MX') + records = DNS.dnslookup(domainName, 'MX', 15) counterGlobal = counterGlobal + 1 @@ -191,9 +191,9 @@ def verificationJob(self): message='IP being used for validation until next sleep: %s.' % (str(self.currentIP))).save() if self.currentIP == None: - server = smtplib.SMTP() + server = smtplib.SMTP(timeout=10) else: - server = smtplib.SMTP(self.currentIP) + server = smtplib.SMTP(self.currentIP, timeout=10) else: if self.currentIP == '': @@ -203,9 +203,9 @@ def verificationJob(self): str(self.currentIP))).save() if self.currentIP == None: - server = smtplib.SMTP() + server = smtplib.SMTP(timeout=10) else: - server = smtplib.SMTP(self.currentIP) + server = smtplib.SMTP(self.currentIP, timeout=10) else: logging.CyberCPLogFileWriter.writeToFile( 'Delay not configured..') @@ -213,15 +213,15 @@ def verificationJob(self): ValidationLog(owner=verificationList, status=backupSchedule.INFO, message='Delay not configured..').save() - server = smtplib.SMTP() + server = smtplib.SMTP(timeout=10) except BaseException as msg: ValidationLog(owner=verificationList, status=backupSchedule.ERROR, message='Delay not configured. Error message: %s' % (str(msg))).save() - server = smtplib.SMTP() + server = smtplib.SMTP(timeout=10) else: - server = smtplib.SMTP() + server = smtplib.SMTP(timeout=10) ###