bug fix: email marketing tool

This commit is contained in:
Usman Nasir
2020-06-04 22:24:51 +05:00
parent 7468b9bf96
commit ba353a4d56
2 changed files with 73 additions and 50 deletions

View File

@@ -188,12 +188,21 @@ class emailMarketing(multi.Thread):
tempPath = "/home/cyberpanel/" + str(randint(1000, 9999))
emailJob = EmailJobs(owner=emailMessage, date=time.strftime("%I-%M-%S-%a-%b-%Y"),
host=self.extraArgs['host'], totalEmails=totalEmails,
sent=sent, failed=failed
)
emailJob.save()
for items in allEmails:
try:
message = MIMEMultipart('alternative')
message['Subject'] = emailMessage.subject
message['From'] = emailMessage.fromEmail
message['reply-to'] = emailMessage.replyTo
if (items.verificationStatus == 'Verified' or self.extraArgs['verificationCheck']) and not items.verificationStatus == 'REMOVED':
if (items.verificationStatus == 'Verified' or self.extraArgs[
'verificationCheck']) and not items.verificationStatus == 'REMOVED':
try:
removalLink = "https:\/\/" + ipAddress + ":8090\/emailMarketing\/remove\/" + self.extraArgs[
@@ -232,15 +241,29 @@ class emailMarketing(multi.Thread):
smtpServer.sendmail(message['From'], items.email, message.as_string())
sent = sent + 1
emailJob.sent = sent
emailJob.save()
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Successfully sent: ' + str(sent) + ' Failed: ' + str(
'Successfully sent: ' + str(
sent) + ' Failed: ' + str(
failed))
except BaseException as msg:
failed = failed + 1
emailJob.failed = failed
emailJob.save()
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Successfully sent: ' + str(
sent) + ', Failed: ' + str(failed))
logging.CyberCPLogFileWriter.writeToFile(str(msg))
except BaseException as msg:
failed = failed + 1
emailJob.failed = failed
emailJob.save()
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'Successfully sent: ' + str(
sent) + ', Failed: ' + str(failed))
logging.CyberCPLogFileWriter.writeToFile(str(msg))
emailJob = EmailJobs(owner=emailMessage, date=time.strftime("%I-%M-%S-%a-%b-%Y"),
host=self.extraArgs['host'], totalEmails=totalEmails,

View File

@@ -684,7 +684,7 @@ class EmailMarketingManager:
em = EM('startEmailJob', extraArgs)
em.start()
time.sleep(2)
time.sleep(5)
data_ret = {"status": 1, 'tempStatusPath': extraArgs['tempStatusPath']}
json_data = json.dumps(data_ret)