From 7165433989b7caf41cc54529413880625f1ada64 Mon Sep 17 00:00:00 2001
From: usmannasir <01-134132-158@student.bahria.edu.pk>
Date: Fri, 19 Oct 2018 22:47:15 +0500
Subject: [PATCH] Bug fixes to Email Marketing
---
.../templates/baseTemplate/index.html | 1 +
emailMarketing/emailMarketing.py | 68 +-
emailMarketing/emailMarketingManager.py | 25 +-
emailMarketing/urls.py | 1 +
emailMarketing/views.py | 8 +
install/install.py | 8 +-
static/emailMarketing/checklist.png | Bin 0 -> 2961 bytes
static/emailMarketing/compose.png | Bin 0 -> 2557 bytes
static/emailMarketing/emailMarketing.js | 1323 +++++++++++++++++
static/emailMarketing/mailing.png | Bin 0 -> 2124 bytes
static/emailMarketing/paper-plane.png | Bin 0 -> 3260 bytes
static/emailMarketing/post-office.png | Bin 0 -> 2511 bytes
12 files changed, 1407 insertions(+), 27 deletions(-)
create mode 100644 static/emailMarketing/checklist.png
create mode 100644 static/emailMarketing/compose.png
create mode 100644 static/emailMarketing/emailMarketing.js
create mode 100644 static/emailMarketing/mailing.png
create mode 100644 static/emailMarketing/paper-plane.png
create mode 100644 static/emailMarketing/post-office.png
diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html
index a46330835..40fd953d0 100755
--- a/baseTemplate/templates/baseTemplate/index.html
+++ b/baseTemplate/templates/baseTemplate/index.html
@@ -554,6 +554,7 @@
{% trans "Email Policy Server" %}
{% trans "Email Limits" %}
{% trans "SpamAssassin" %}
+ {% trans "Email Marketing" %}
diff --git a/emailMarketing/emailMarketing.py b/emailMarketing/emailMarketing.py
index ff6485d06..393c8d732 100644
--- a/emailMarketing/emailMarketing.py
+++ b/emailMarketing/emailMarketing.py
@@ -43,17 +43,21 @@ class emailMarketing(multi.Thread):
with open(self.extraArgs['path'], 'r') as emailsList:
data = csv.reader(emailsList, delimiter=',')
for items in data:
- for value in items:
- if re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', value) != None:
- try:
- getEmail = EmailsInList.objects.get(owner=newList, email=value)
- except:
- newEmail = EmailsInList(owner=newList, email=value,
- verificationStatus='NOT CHECKED',
- dateCreated=time.strftime("%I-%M-%S-%a-%b-%Y"))
- newEmail.save()
- logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + ' emails read.')
- counter = counter + 1
+ try:
+ for value in items:
+ if re.match('^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', value) != None:
+ try:
+ getEmail = EmailsInList.objects.get(owner=newList, email=value)
+ except:
+ newEmail = EmailsInList(owner=newList, email=value,
+ verificationStatus='NOT CHECKED',
+ dateCreated=time.strftime("%I-%M-%S-%a-%b-%Y"))
+ newEmail.save()
+ logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], str(counter) + ' emails read.')
+ counter = counter + 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg))
+ continue
elif self.extraArgs['path'].endswith('.txt'):
with open(self.extraArgs['path'], 'r') as emailsList:
emails = emailsList.readline()
@@ -137,13 +141,14 @@ class emailMarketing(multi.Thread):
domain = verificationList.owner.domain
tempStatusPath = '/home/cyberpanel/' + domain + "/" + self.extraArgs['listName']
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, str(msg) +'. [404]')
+ logging.CyberCPLogFileWriter.writeToFile('your error')
return 0
def startEmailJob(self):
try:
try:
if self.extraArgs['host'] == 'localhost':
- smtpServer = smtplib.SMTP(self.extraArgs['host'])
+ smtpServer = smtplib.SMTP('127.0.0.1')
else:
verifyHost = SMTPHosts.objects.get(host=self.extraArgs['host'])
smtpServer = smtplib.SMTP(verifyHost.host, int(verifyHost.port))
@@ -169,6 +174,11 @@ class emailMarketing(multi.Thread):
sent = 0
failed = 0
+ ipFile = "/etc/cyberpanel/machineIP"
+ f = open(ipFile)
+ ipData = f.read()
+ ipAddress = ipData.split('\n', 1)[0]
+
## Compose Message
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@@ -178,17 +188,34 @@ class emailMarketing(multi.Thread):
message['Subject'] = emailMessage.subject
message['From'] = emailMessage.fromEmail
- if re.search('', emailMessage.emailMessage, re.IGNORECASE):
- html = MIMEText(emailMessage.emailMessage, 'html')
- message.attach(html)
- else:
- html = MIMEText(emailMessage.emailMessage, 'plain')
- message.attach(html)
-
for items in allEmails:
- if items.verificationStatus == 'Verified' or self.extraArgs['verificationCheck']:
+ if (items.verificationStatus == 'Verified' or self.extraArgs['verificationCheck']) and not items.verificationStatus == 'REMOVED':
try:
+ if re.search('', emailMessage.emailMessage, re.IGNORECASE):
+ html = MIMEText(emailMessage.emailMessage, 'html')
+ message.attach(html)
+
+ if self.extraArgs['unsubscribeCheck']:
+ removalMessage = '
Unsubscribe from future emails.'
+ additionalCheck = MIMEText(removalMessage, 'html')
+ message.attach(additionalCheck)
+ else:
+ html = MIMEText(emailMessage.emailMessage, 'plain')
+ message.attach(html)
+ if self.extraArgs['unsubscribeCheck']:
+ finalMessage = '\n\n Unsubscribe by visiting https://' + ipAddress + ':8090/emailMarketing/remove/' + \
+ self.extraArgs[
+ 'listName'] + "/" + items.email
+
+ html = MIMEText(finalMessage, 'plain')
+ message.attach(html)
+
+
+
+
smtpServer.sendmail(message['From'], items.email, message.as_string())
sent = sent + 1
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
@@ -198,6 +225,7 @@ class emailMarketing(multi.Thread):
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"),
diff --git a/emailMarketing/emailMarketingManager.py b/emailMarketing/emailMarketingManager.py
index 9acfb2a68..dd61dff80 100644
--- a/emailMarketing/emailMarketingManager.py
+++ b/emailMarketing/emailMarketingManager.py
@@ -662,8 +662,15 @@ class EmailMarketingManager:
extraArgs['selectedTemplate'] = data['selectedTemplate']
extraArgs['listName'] = data['listName']
extraArgs['host'] = data['host']
- extraArgs['verificationCheck'] = data['verificationCheck']
- extraArgs['unsubscribeCheck'] = data['unsubscribeCheck']
+ try:
+ extraArgs['verificationCheck'] = data['verificationCheck']
+ except:
+ extraArgs['verificationCheck'] = False
+ try:
+ extraArgs['unsubscribeCheck'] = data['unsubscribeCheck']
+ except:
+ extraArgs['unsubscribeCheck'] = False
+
extraArgs['tempStatusPath'] = "/home/cyberpanel/" + data['selectedTemplate'] + '_pendingJob'
currentACL = ACLManager.loadedACL(userID)
@@ -730,4 +737,16 @@ class EmailMarketingManager:
except BaseException, msg:
final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
- return HttpResponse(final_json)
\ No newline at end of file
+ return HttpResponse(final_json)
+
+
+ def remove(self, listName, emailAddress):
+ try:
+ eList = EmailLists.objects.get(listName=listName)
+ removeEmail = EmailsInList.objects.get(owner=eList, email=emailAddress)
+ removeEmail.verificationStatus = 'REMOVED'
+ removeEmail.save()
+ except:
+ pass
+
+ return HttpResponse('Email Address Successfully removed from the list.')
\ No newline at end of file
diff --git a/emailMarketing/urls.py b/emailMarketing/urls.py
index b8bf67151..2f1f56aff 100644
--- a/emailMarketing/urls.py
+++ b/emailMarketing/urls.py
@@ -23,4 +23,5 @@ urlpatterns = [
url(r'^startEmailJob$', views.startEmailJob, name='startEmailJob'),
url(r'^deleteTemplate$', views.deleteTemplate, name='deleteTemplate'),
url(r'^deleteJob$', views.deleteJob, name='deleteJob'),
+ url(r'^remove/(?P[-\w]+)/(?P\w+@.+)$', views.remove, name='remove'),
]
\ No newline at end of file
diff --git a/emailMarketing/views.py b/emailMarketing/views.py
index a5ba2efc4..76be7dd8f 100644
--- a/emailMarketing/views.py
+++ b/emailMarketing/views.py
@@ -179,5 +179,13 @@ def deleteJob(request):
userID = request.session['userID']
emm = EmailMarketingManager(request)
return emm.deleteJob()
+ except KeyError:
+ return redirect(loadLoginPage)
+
+
+def remove(request, listName, emailAddress):
+ try:
+ emm = EmailMarketingManager(request)
+ return emm.remove(listName, emailAddress)
except KeyError:
return redirect(loadLoginPage)
\ No newline at end of file
diff --git a/install/install.py b/install/install.py
index 46fa22abb..11163393c 100644
--- a/install/install.py
+++ b/install/install.py
@@ -687,8 +687,8 @@ class preFlightsChecks:
count = 0
while (1):
- #command = "wget http://cyberpanel.net/CyberPanel.1.7.2.tar.gz"
- command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
+ command = "wget http://cyberpanel.net/CyberPanel.1.7.2.tar.gz"
+ #command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
res = subprocess.call(shlex.split(command))
if res == 1:
@@ -707,8 +707,8 @@ class preFlightsChecks:
count = 0
while(1):
- #command = "tar zxf CyberPanel.1.7.2.tar.gz"
- command = "tar zxf CyberPanelTemp.tar.gz"
+ command = "tar zxf CyberPanel.1.7.2.tar.gz"
+ #command = "tar zxf CyberPanelTemp.tar.gz"
res = subprocess.call(shlex.split(command))
diff --git a/static/emailMarketing/checklist.png b/static/emailMarketing/checklist.png
new file mode 100644
index 0000000000000000000000000000000000000000..bb709fb21690ff7679504ba461ea2c4bf7d746ac
GIT binary patch
literal 2961
zcmV;C3vTp@P)47#YFj
z;l10`w$4(|thGk~II=bgFNNHx{0na#;EU6jS+!~vQ>RXKssHHFqdfie(?tEGD;u7l
zVpmsLYvSSOwgT-WK&g9q09033qt$BB
z>2$5q)2<Ti;znz_ZgHWajuGt#0S*f2
zRQJRTU}owvY4MDphO>vWFq!N5;%pJ-`kM)nYel7m2B?wA<)~CD
zWOC=p5l=!$l7tXK3H%9o0cbIOGH3lNV#bebv!UYLEBy7LSuNHn^6r;;B#w=wTz8{$2ml@fcqFbrGsZ^q
z!{rj{%odwKb*;(zYc^4Cs%^8O$~psJ4fu3!kzL)xBO)m-t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zGZx7$P!|ZqK={8`xaqi&cxudh^4p0AoAD{mp{ceWv
T|KVWZ00000NkvXXu0mjfO;z3U
literal 0
HcmV?d00001
diff --git a/static/emailMarketing/emailMarketing.js b/static/emailMarketing/emailMarketing.js
new file mode 100644
index 000000000..2e32e0a98
--- /dev/null
+++ b/static/emailMarketing/emailMarketing.js
@@ -0,0 +1,1323 @@
+/**
+ * Created by usman on 8/1/17.
+ */
+
+var emailListURL = "/emailMarketing/"+ $("#domainNamePage").text() + "/emailLists";
+$("#emailLists").attr("href", emailListURL);
+$("#emailListsChild").attr("href", emailListURL);
+
+var manageListsURL = "/emailMarketing/"+ $("#domainNamePage").text() + "/manageLists";
+$("#manageLists").attr("href", manageListsURL);
+$("#manageListsChild").attr("href", manageListsURL);
+
+var sendEmailsURL = "/emailMarketing/sendEmails";
+$("#sendEmailsPage").attr("href", sendEmailsURL);
+$("#sendEmailsPageChild").attr("href", sendEmailsURL);
+
+var composeEmailURL = "/emailMarketing/composeEmailMessage";
+$("#composeEmails").attr("href", composeEmailURL);
+$("#composeEmailsChild").attr("href", composeEmailURL);
+
+var smtpHostsURL = "/emailMarketing/"+ $("#domainNamePage").text() + "/manageSMTP";
+$("#manageSMTPHosts").attr("href", smtpHostsURL);
+$("#manageSMTPHostsChild").attr("href", smtpHostsURL);
+
+
+app.controller('emailMarketing', function($scope,$http) {
+
+ $scope.cyberPanelLoading = true;
+ $scope.fetchUsers = function(){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/fetchUsers";
+
+ var data = {};
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.users = JSON.parse(response.data.data);
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+ $scope.fetchUsers();
+ $scope.enableDisableMarketing = function(status, userName){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/enableDisableMarketing";
+
+ var data = {userName: userName};
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ $scope.fetchUsers();
+
+ if(response.data.status === 1){
+ new PNotify({
+ title: 'Success!',
+ text: 'Changes successfully saved.',
+ type:'success'
+ });
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+});
+
+app.controller('createEmailList', function($scope, $http, $timeout) {
+
+ $scope.installationDetailsForm = false;
+ $scope.installationProgress = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = true;
+
+ var statusFile;
+ var path;
+
+
+ $scope.goBack = function () {
+ $scope.installationDetailsForm = false;
+ $scope.installationProgress = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = true;
+ $("#installProgress").css("width", "0%");
+ };
+
+ $scope.createEmailList = function(){
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = false;
+ $scope.goBackDisable = true;
+ $scope.currentStatus = "Starting to load email addresses..";
+
+
+ url = "/emailMarketing/submitEmailList";
+
+ var data = {
+ domain: $("#domainNamePage").text(),
+ path:$scope.path,
+ listName: $scope.listName
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+ if (response.data.status === 1)
+ {
+ statusFile = response.data.tempStatusPath;
+ getInstallStatus();
+ }
+ else{
+
+ $scope.installationDetailsForm = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+ function getInstallStatus(){
+
+ url = "/websites/installWordpressStatus";
+
+ var data = {
+ statusFile: statusFile,
+ domainName: $("#domainNamePage").text()
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.abort === 1){
+
+ if(response.data.installStatus === 1){
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = 'Emails successfully loaded.';
+ $timeout.cancel();
+
+ }
+ else{
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = response.data.error_message;
+
+
+ }
+
+ }
+ else{
+ $scope.installPercentage = response.data.installationProgress;
+ $scope.currentStatus = response.data.currentStatus;
+
+ $timeout(getInstallStatus,1000);
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+
+ }
+
+
+ }
+
+ $scope.fetchEmails = function(){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/fetchEmails";
+
+ var data = {'listName': $scope.listName};
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.records = JSON.parse(response.data.data);
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+
+});
+
+app.controller('manageEmailLists', function($scope, $http, $timeout) {
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = true;
+ $scope.verificationStatus = true;
+
+ var statusFile;
+ var path;
+
+
+ $scope.goBack = function () {
+ $scope.installationDetailsForm = false;
+ $scope.installationProgress = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = true;
+ $("#installProgress").css("width", "0%");
+ };
+
+ $scope.createEmailList = function(){
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = false;
+ $scope.goBackDisable = true;
+ $scope.currentStatus = "Starting to load email addresses..";
+
+
+ url = "/emailMarketing/submitEmailList";
+
+ var data = {
+ domain: $("#domainNamePage").text(),
+ path:$scope.path,
+ listName: $scope.listName
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+ if (response.data.status === 1)
+ {
+ statusFile = response.data.tempStatusPath;
+ getInstallStatus();
+ }
+ else{
+
+ $scope.installationDetailsForm = true;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+ function getInstallStatus(){
+
+ url = "/websites/installWordpressStatus";
+
+ var data = {
+ statusFile: statusFile,
+ domainName: $("#domainNamePage").text()
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.abort === 1){
+
+ if(response.data.installStatus === 1){
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = 'Emails successfully loaded.';
+ $timeout.cancel();
+
+ }
+ else{
+
+ $scope.installationDetailsForm = true;
+ $scope.installationProgress = false;
+ $scope.cyberPanelLoading = true;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = response.data.error_message;
+
+
+ }
+
+ }
+ else{
+ $scope.installPercentage = response.data.installationProgress;
+ $scope.currentStatus = response.data.currentStatus;
+
+ $timeout(getInstallStatus,1000);
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+
+ }
+
+
+ }
+
+
+ ///
+
+ $scope.currentRecords = true;
+
+ $scope.recordstoShow = 50;
+ var globalPage;
+
+ $scope.fetchRecords = function () {
+ $scope.fetchEmails(globalPage);
+ };
+
+ $scope.fetchEmails = function(page){
+ globalPage = page;
+ listVerificationStatus();
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/fetchEmails";
+
+ var data = {
+ 'listName': $scope.listName,
+ 'recordstoShow': $scope.recordstoShow,
+ 'page': page
+
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.currentRecords = false;
+ $scope.records = JSON.parse(response.data.data);
+ $scope.pagination = response.data.pagination;
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+ $scope.deleteList = function () {
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/deleteList";
+
+ var data = {
+ listName: $scope.listName
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ if (response.data.status === 1)
+ {
+ new PNotify({
+ title: 'Success!',
+ text: 'Emails Successfully Deleted.',
+ type:'success'
+ });
+ }
+ else{
+
+ $scope.cyberPanelLoading = false;
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+ $scope.showAddEmails = function () {
+ $scope.installationDetailsForm = false;
+ $scope.verificationStatus = true;
+ };
+
+ // List Verification
+
+ $scope.startVerification = function () {
+
+ $scope.currentStatusVerification = 'Email verification job started..';
+ $scope.installationDetailsForm = true;
+ $scope.verificationStatus = false;
+ $scope.verificationButton = true;
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/emailVerificationJob";
+
+ var data = {
+ listName: $scope.listName
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+ if (response.data.status === 1)
+ {
+ listVerificationStatus();
+ $scope.verificationButton = true;
+ }
+ else{
+
+ $scope.cyberPanelLoading = true;
+ $scope.verificationButton = false;
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ $scope.verificationButton = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+
+ };
+
+ var globalCounter = 0;
+
+ function listVerificationStatus(){
+
+ $scope.verificationButton = true;
+ $scope.cyberPanelLoading = false;
+
+ url = "/websites/installWordpressStatus";
+
+ var data = {
+ domain: $("#domainNamePage").text(),
+ statusFile: "/home/cyberpanel/" + $("#domainNamePage").text() + "/" + $scope.listName
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.abort === 1){
+
+ if(response.data.installStatus === 1){
+ $scope.cyberPanelLoading = true;
+ $scope.verificationButton = false;
+ $scope.currentStatusVerification = 'Emails successfully verified.';
+ $timeout.cancel();
+
+ }
+ else{
+
+ if(response.data.error_message.search('No such file') > -1){
+ $scope.verificationButton = false;
+ return;
+ }
+ $scope.verificationButton = true;
+ $scope.cyberPanelLoading = false;
+ $scope.verificationStatus = false;
+ $scope.currentStatusVerification = response.data.error_message;
+
+ }
+
+ }
+ else{
+ $scope.currentStatusVerification = response.data.currentStatus;
+ $timeout(listVerificationStatus,1000);
+ $scope.verificationStatus = false;
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+
+ }
+
+
+ }
+
+ // Delete Email from list
+
+ $scope.deleteEmail = function(id){
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/deleteEmail";
+
+ var data = {
+ id: id
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ $scope.fetchEmails(globalPage);
+
+ if (response.data.status === 1)
+ {
+ $scope.fetchEmails(globalPage);
+ new PNotify({
+ title: 'Success.',
+ text: 'Email Successfully deleted.',
+ type:'success'
+ });
+
+ }
+ else{
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+
+});
+
+app.controller('manageSMTPHostsCTRL', function($scope, $http) {
+
+ $scope.cyberPanelLoading = true;
+ $scope.fetchSMTPHosts = function(){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/fetchSMTPHosts";
+
+ var data = {};
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.records = JSON.parse(response.data.data);
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+ $scope.fetchSMTPHosts();
+ $scope.saveSMTPHost = function(status, userName){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/saveSMTPHost";
+
+ var data = {
+ smtpHost: $scope.smtpHost,
+ smtpPort: $scope.smtpPort,
+ smtpUserName: $scope.smtpUserName,
+ smtpPassword: $scope.smtpPassword
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.fetchSMTPHosts();
+ new PNotify({
+ title: 'Success!',
+ text: 'Successfully saved new SMTP host.',
+ type:'success'
+ });
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+ $scope.smtpHostOperations = function(operation, id){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/smtpHostOperations";
+
+ var data = {
+ id: id,
+ operation: operation
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ $scope.fetchSMTPHosts();
+
+ if(response.data.status === 1){
+ new PNotify({
+ title: 'Success!',
+ text: response.data.message,
+ type:'success'
+ });
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+});
+
+app.controller('composeMessageCTRL', function($scope, $http) {
+
+ $scope.cyberPanelLoading = true;
+ $scope.saveTemplate = function(status, userName){
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/saveEmailTemplate";
+
+ var data = {
+ name: $scope.name,
+ subject: $scope.subject,
+ fromName: $scope.fromName,
+ fromEmail: $scope.fromEmail,
+ replyTo: $scope.replyTo,
+ emailMessage: $scope.emailMessage
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ new PNotify({
+ title: 'Success!',
+ text: 'Template successfully saved.',
+ type:'success'
+ });
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+});
+
+app.controller('sendEmailsCTRL', function($scope, $http, $timeout) {
+
+ $scope.cyberPanelLoading = true;
+ $scope.availableFunctions = true;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = true;
+
+ // Button
+
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+
+ $scope.templateSelected = function () {
+ $scope.availableFunctions = false;
+ $scope.sendEmailsView = true;
+ $scope.previewLink = '/emailMarketing/preview/' + $scope.selectedTemplate;
+ $scope.jobStatus = true;
+ emailJobStatus();
+
+ };
+
+ $scope.sendEmails = function () {
+ $scope.sendEmailsView = false;
+ $scope.fetchJobs();
+ };
+
+ $scope.fetchJobs = function(){
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/fetchJobs";
+
+ var data = {
+ 'selectedTemplate': $scope.selectedTemplate
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ $scope.currentRecords = false;
+ $scope.records = JSON.parse(response.data.data);
+ }
+ else{
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+
+ $scope.startEmailJob = function () {
+ $scope.cyberPanelLoading = false;
+ $scope.deleteTemplateBTN = true;
+ $scope.sendEmailBTN = true;
+ $scope.sendEmailsView = true;
+ $scope.goBackDisable = true;
+
+ url = "/emailMarketing/startEmailJob";
+
+
+ var data = {
+ 'selectedTemplate': $scope.selectedTemplate,
+ 'listName': $scope.listName,
+ 'host': $scope.host,
+ 'verificationCheck': $scope.verificationCheck,
+ 'unsubscribeCheck': $scope.unsubscribeCheck
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if(response.data.status === 1){
+ emailJobStatus();
+ }
+ else{
+ $scope.cyberPanelLoading = true;
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+ $scope.sendEmailsView = false;
+ $scope.jobStatus = true;
+ $scope.goBackDisable = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = false;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+
+ };
+
+ function emailJobStatus(){
+
+ $scope.cyberPanelLoading = false;
+ $scope.deleteTemplateBTN = true;
+ $scope.sendEmailBTN = true;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = false;
+ $scope.goBackDisable = true;
+
+ url = "/websites/installWordpressStatus";
+
+ var data = {
+ domain: 'example.com',
+ statusFile: "/home/cyberpanel/" + $scope.selectedTemplate + "_pendingJob"
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.abort === 1){
+
+ if(response.data.installStatus === 1){
+ $scope.cyberPanelLoading = true;
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = false;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = 'Emails successfully sent.';
+ $scope.fetchJobs();
+ $timeout.cancel();
+
+ }
+ else{
+
+ if(response.data.error_message.search('No such file') > -1){
+ $scope.cyberPanelLoading = true;
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = true;
+ $scope.goBackDisable = false;
+ return;
+ }
+ $scope.cyberPanelLoading = true;
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = false;
+ $scope.goBackDisable = false;
+ $scope.currentStatus = response.data.error_message;
+
+ }
+
+ }
+ else{
+ $scope.currentStatus = response.data.currentStatus;
+ $timeout(emailJobStatus,1000);
+ $scope.cyberPanelLoading = false;
+ $scope.deleteTemplateBTN = true;
+ $scope.sendEmailBTN = true;
+ $scope.sendEmailsView = true;
+ $scope.jobStatus = false;
+ $scope.goBackDisable = true;
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page.',
+ type:'error'
+ });
+
+
+ }
+
+
+ }
+
+ $scope.goBack = function () {
+ $scope.cyberPanelLoading = true;
+ $scope.deleteTemplateBTN = false;
+ $scope.sendEmailBTN = false;
+ $scope.sendEmailsView = false;
+ $scope.jobStatus = true;
+
+ };
+
+ $scope.deleteTemplate = function(){
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/deleteTemplate";
+
+ var data = {
+ selectedTemplate: $scope.selectedTemplate
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+
+ if (response.data.status === 1)
+ {
+ new PNotify({
+ title: 'Success.',
+ text: 'Template Successfully deleted.',
+ type:'success'
+ });
+
+ }
+ else{
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+ $scope.deleteJob = function(id){
+
+ $scope.cyberPanelLoading = false;
+
+ url = "/emailMarketing/deleteJob";
+
+ var data = {
+ id: id
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ $scope.fetchJobs();
+
+ if (response.data.status === 1)
+ {
+ new PNotify({
+ title: 'Success.',
+ text: 'Template Successfully deleted.',
+ type:'success'
+ });
+
+ }
+ else{
+
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type:'error'
+ });
+
+ }
+
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type:'error'
+ });
+
+ }
+
+ };
+});
+
+
diff --git a/static/emailMarketing/mailing.png b/static/emailMarketing/mailing.png
new file mode 100644
index 0000000000000000000000000000000000000000..b8586aea2c6ae186c8d02b71572fd44ae17f9dc6
GIT binary patch
literal 2124
zcmV-S2($NzP)HbQF`&wWpDkcGLJS6~i*v}e$FcwDX>RuP2TBzX
z454Onmwt)l?EG=@jC&ePi;HGc^$6JK3g$fwcN
z$`=MBsYQ#)T~t0lV8{T1WPk@HnRYtNvB8uuy(2VjK(GY_8`A~^TR^ZeZ9uRE1RI*`
z0JF<{q~F}1t`@WRZzmt??C$-k=Q-LM{=M4!i{4Nx^UJsDK6Xoz`YxVDF@_F4{FT)e
zYVma+{I&YZ<<_S?&+$o#&y`g^_>Ni`_kh!(mJdD{P?1JInE#^|v!lJE139!+extXy
zqiU8$ncICXfXj+p*Jlcb&M{kCTAF|V?V52PEKd0@Fy#$U?E;H`
zc3=%|u||tT3NdT4&x!?b7k-CX5xtzhVP(Lj=yOEVxXM%zv%-{V>n1n7fw~LH3XKI8@*KCvOI?!OVl{;f
zkQLKGYqyoFw=FiccroTZ!PY010Ivesqci2ZNY;_GyTyNbs|>W+o<#Bkzzjgw?$7cJ
zU`l--XV?nz9R43Dek$x3*bP*Tk=umi8x+VxBQr*Kfwpx!fsYuo@&KX=ML1}CLiGaT
zC|p>dK%1=&$#Zxr?}b4aIR8bI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