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 000000000..bb709fb21
Binary files /dev/null and b/static/emailMarketing/checklist.png differ
diff --git a/static/emailMarketing/compose.png b/static/emailMarketing/compose.png
new file mode 100644
index 000000000..eaf70c277
Binary files /dev/null and b/static/emailMarketing/compose.png differ
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 000000000..b8586aea2
Binary files /dev/null and b/static/emailMarketing/mailing.png differ
diff --git a/static/emailMarketing/paper-plane.png b/static/emailMarketing/paper-plane.png
new file mode 100644
index 000000000..8135fdfb1
Binary files /dev/null and b/static/emailMarketing/paper-plane.png differ
diff --git a/static/emailMarketing/post-office.png b/static/emailMarketing/post-office.png
new file mode 100644
index 000000000..6cdfb54cc
Binary files /dev/null and b/static/emailMarketing/post-office.png differ