mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
bug fix: email marketing tool
This commit is contained in:
@@ -52,14 +52,17 @@ class emailMarketing(multi.Thread):
|
|||||||
try:
|
try:
|
||||||
getEmail = EmailsInList.objects.get(owner=newList, email=value)
|
getEmail = EmailsInList.objects.get(owner=newList, email=value)
|
||||||
except:
|
except:
|
||||||
|
try:
|
||||||
newEmail = EmailsInList(owner=newList, email=value,
|
newEmail = EmailsInList(owner=newList, email=value,
|
||||||
verificationStatus='NOT CHECKED',
|
verificationStatus='NOT CHECKED',
|
||||||
dateCreated=time.strftime("%I-%M-%S-%a-%b-%Y"))
|
dateCreated=time.strftime("%I-%M-%S-%a-%b-%Y"))
|
||||||
newEmail.save()
|
newEmail.save()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + ' emails read.')
|
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + ' emails read.')
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
logging.CyberCPLogFileWriter.writeToFile('%s. [createEmailList]' % (str(msg)))
|
||||||
continue
|
continue
|
||||||
elif self.extraArgs['path'].endswith('.txt'):
|
elif self.extraArgs['path'].endswith('.txt'):
|
||||||
with open(self.extraArgs['path'], 'r') as emailsList:
|
with open(self.extraArgs['path'], 'r') as emailsList:
|
||||||
@@ -155,6 +158,7 @@ class emailMarketing(multi.Thread):
|
|||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO, message='Starting email verification..').save()
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO, message='Starting email verification..').save()
|
||||||
|
|
||||||
for items in allEmailsInList:
|
for items in allEmailsInList:
|
||||||
|
|
||||||
if items.verificationStatus != 'Verified':
|
if items.verificationStatus != 'Verified':
|
||||||
try:
|
try:
|
||||||
email = items.email
|
email = items.email
|
||||||
@@ -162,10 +166,10 @@ class emailMarketing(multi.Thread):
|
|||||||
domainName = email.split('@')[1]
|
domainName = email.split('@')[1]
|
||||||
records = DNS.dnslookup(domainName, 'MX')
|
records = DNS.dnslookup(domainName, 'MX')
|
||||||
|
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
counterGlobal = counterGlobal + 1
|
||||||
message='Trying to verify %s ..' % (email)).save()
|
|
||||||
|
|
||||||
for mxRecord in records:
|
for mxRecord in records:
|
||||||
|
|
||||||
# Get local server hostname
|
# Get local server hostname
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
|
|
||||||
@@ -173,12 +177,8 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
if os.path.exists(finalPath):
|
if os.path.exists(finalPath):
|
||||||
try:
|
try:
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
|
||||||
message='Checking if delay is enabled for verification..').save()
|
|
||||||
delay = self.delayData['delay']
|
delay = self.delayData['delay']
|
||||||
if delay == 'Enable':
|
if delay == 'Enable':
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
|
||||||
message='It seems delay is enabled...').save()
|
|
||||||
if counterGlobal == int(self.delayData['delayAfter']):
|
if counterGlobal == int(self.delayData['delayAfter']):
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
message='Sleeping for %s seconds...' % (self.delayData['delayTime'])).save()
|
message='Sleeping for %s seconds...' % (self.delayData['delayTime'])).save()
|
||||||
@@ -198,7 +198,6 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
if self.currentIP == '':
|
if self.currentIP == '':
|
||||||
self.currentIP = self.findNextIP()
|
self.currentIP = self.findNextIP()
|
||||||
|
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
||||||
message='IP being used for validation until next sleep: %s.' % (
|
message='IP being used for validation until next sleep: %s.' % (
|
||||||
str(self.currentIP))).save()
|
str(self.currentIP))).save()
|
||||||
@@ -222,8 +221,6 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
else:
|
else:
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
|
||||||
message='Delay not configured..').save()
|
|
||||||
server = smtplib.SMTP()
|
server = smtplib.SMTP()
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -239,8 +236,6 @@ class emailMarketing(multi.Thread):
|
|||||||
|
|
||||||
# Assume 250 as Success
|
# Assume 250 as Success
|
||||||
if code == 250:
|
if code == 250:
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.INFO,
|
|
||||||
message='Verified %s successfully.' % (email)).save()
|
|
||||||
items.verificationStatus = 'Verified'
|
items.verificationStatus = 'Verified'
|
||||||
items.save()
|
items.save()
|
||||||
break
|
break
|
||||||
@@ -250,20 +245,18 @@ class emailMarketing(multi.Thread):
|
|||||||
items.verificationStatus = 'Verification Failed'
|
items.verificationStatus = 'Verification Failed'
|
||||||
items.save()
|
items.save()
|
||||||
|
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails verified so far..')
|
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(counter) + ' emails verified so far..')
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
items.verificationStatus = 'Verification Failed'
|
items.verificationStatus = 'Verification Failed'
|
||||||
items.save()
|
items.save()
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
|
||||||
ValidationLog(owner=verificationList, status=backupSchedule.ERROR,
|
ValidationLog(owner=verificationList, status=backupSchedule.ERROR,
|
||||||
message='Failed to verify %s. Error message %s' % (
|
message='Failed to verify %s. Error message %s' % (
|
||||||
self.currentEmail , str(msg))).save()
|
self.currentEmail , str(msg))).save()
|
||||||
|
|
||||||
|
|
||||||
counterGlobal = counterGlobal + 1
|
|
||||||
|
|
||||||
verificationList.notVerified = verificationList.emailsinlist_set.filter(verificationStatus='Verification Failed').count()
|
verificationList.notVerified = verificationList.emailsinlist_set.filter(verificationStatus='Verification Failed').count()
|
||||||
verificationList.verified = verificationList.emailsinlist_set.filter(verificationStatus='Verified').count()
|
verificationList.verified = verificationList.emailsinlist_set.filter(verificationStatus='Verified').count()
|
||||||
verificationList.save()
|
verificationList.save()
|
||||||
|
|||||||
@@ -1882,7 +1882,7 @@ class WebsiteManager:
|
|||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
data_ret = {'abort': 1, 'installStatus': 0, 'installationProgress': "0", 'error_message': str(msg)}
|
data_ret = {'abort': 0, 'installStatus': 0, 'installationProgress': "0", 'error_message': str(msg)}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user