diff --git a/Check_Email_SMTP_Tab.php b/Check_Email_SMTP_Tab.php
new file mode 100644
index 0000000..39b2598
--- /dev/null
+++ b/Check_Email_SMTP_Tab.php
@@ -0,0 +1,331 @@
+setup_vars();
+
+ add_action( 'check_mail_smtp_form', array($this, 'load_smtp_settings'));
+ add_action('admin_init', array($this, 'smtp_form_submission_handler'));
+
+ if(isset($this->smtp_options['enable_smtp'])){
+ add_action( 'phpmailer_init', array( $this,'check_mail_smtp' ) );
+ add_action( 'check_mail_smtp_admin_update', array($this, 'check_credentials'));
+ add_action( 'admin_notices', array( $this, 'retype_credentials_notice' ) );
+ $this->check_credentials();
+ }
+ }
+
+ /**
+ * Get smtp options
+ *
+ * @return void
+ * @since 1.0.12
+ */
+ public function setup_vars(){
+ $this->smtp_options = get_option('check-email-smtp-options', true);
+ }
+
+ /**
+ * PHP mailer setup for SMTP
+ *
+ * @return void
+ * @since 1.0.12
+ */
+ public function check_mail_smtp( $phpmailer ) {
+
+ if( ! is_email($this->smtp_options["smtp_from"] ) || empty( $this->smtp_options["smtp_host"] ) ) {
+ return;
+ }
+
+ $phpmailer->Mailer = "smtp";
+ $phpmailer->From = $this->smtp_options["smtp_from"];
+ $phpmailer->FromName = $this->smtp_options["smtp_from_name"];
+ $phpmailer->Sender = $phpmailer->From;
+ $phpmailer->AddReplyTo($phpmailer->From,$phpmailer->FromName);
+ $phpmailer->Host = $this->smtp_options["smtp_host"];
+ $phpmailer->SMTPSecure = $this->smtp_options["smtp_secure"];
+ $phpmailer->Port = $this->smtp_options["smtp_port"];
+ $phpmailer->SMTPAuth = ($this->smtp_options["smtp_auth"]=="yes") ? TRUE : FALSE;
+
+ if( $phpmailer->SMTPAuth ){
+ $phpmailer->Username = base64_decode( $this->smtp_options["smtp_username"] );
+ $phpmailer->Password = base64_decode( $this->smtp_options["smtp_password"] );
+ }
+ }
+
+ /**
+ * Check for credentials
+ *
+ * @param array $options WP SMTP options
+ *
+ * @return mixed
+ * @since 1.0.12
+ */
+ public function check_credentials( $options = array(), $pass_ajax = false ) {
+
+ if ( ! is_admin() || ( ! $pass_ajax && defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
+ return;
+ }
+
+ $encription = get_option( 'check_email_smtp_status' );
+
+ // Connecting to host can be a resource heavy task, so we only do it if we need to.
+ if ( 'encrypted' === $encription ) {
+ return true;
+ }
+
+ // Connecting to host can be a resource heavy task, so we only do it if we need to.
+ if ( 'not_encrypted' === $encription ) {
+ add_action( 'admin_notices', array( $this, 'retype_credentials_notice' ) );
+
+ return false;
+ }
+
+ if ( empty( $options ) ) {
+ $options = get_option( 'check-email-smtp-options' );
+ }
+
+ if ( ! isset( $options['smtp_username'] ) || ! isset( $options['smtp_password'] ) || ! isset( $options['smtp_host'] ) || ! isset( $options['smtp_port'] ) || ! isset( $options['smtp_auth'] ) || ! isset( $options['smtp_secure'] ) || '' === $options['smtp_username'] || '' === $options['smtp_password'] || '' === $options['smtp_host'] || '' === $options['smtp_port'] || '' === $options['smtp_auth'] ) {
+ return false;
+ }
+
+ global $phpmailer;
+
+ // (Re)create it, if it's gone missing.
+ if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) {
+ require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
+ require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
+ require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
+ $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );
+ }
+
+ // Set the timeout to 15 seconds, so if it doesn't connect to not let the user in standby.
+ $smtp = $phpmailer->getSMTPInstance();
+ $smtp->Timeout = 15;
+ $smtp->Timelimit = 15;
+ $phpmailer->Timeout = 15;
+ $phpmailer->Timelimit = 15;
+ $phpmailer->Mailer = "smtp";
+ $phpmailer->Host = $options['smtp_host'];
+ $phpmailer->SMTPAuth = 'yes' === $options['smtp_auth']; // Ask it to use authenticate using the Username and Password properties
+ $phpmailer->Port = $options['smtp_port'];
+ $phpmailer->SMTPKeepAlive = false;
+
+ if ( $phpmailer->SMTPAuth ) {
+ $phpmailer->Username = base64_decode($options['smtp_username']);
+ $phpmailer->Password = base64_decode($options['smtp_password']);
+ }
+
+ $phpmailer->SMTPSecure = $options['smtp_secure']; // preferable but optional
+
+ try {
+ if ( $phpmailer->smtpConnect() ) {
+ update_option( 'check_email_smtp_status', 'encrypted' );
+ return true;
+ } else {
+ update_option( 'check_email_smtp_status', 'not_encrypted' );
+ return false;
+ }
+ } catch ( Exception $e ) {
+ update_option( 'check_email_smtp_status', 'not_encrypted' );
+ return false;
+ }
+ }
+
+ /**
+ * Render SMTP form
+ *
+ * @return void
+ * @since 1.0.12
+ */
+ public function load_smtp_settings(){
+ $enable_smtp = isset($this->smtp_options['enable_smtp'])?$this->smtp_options['enable_smtp']:'';
+ $smtp_checked = "";
+ $style = "display: none";
+ if($enable_smtp == 'on'){
+ $smtp_checked = "checked";
+ $style = "";
+ }
+ ?>
+
+
+
+ '+ck_mail_localize_data.using_ck_mail+'';
+ content += ''+ck_mail_localize_data.do_you_want+' '+ck_mail_localize_data.ck_mail_update+' '+ck_mail_localize_data.before_others+'
';
+ content += '';
+ content += '';
+ content += '
';
+ content += '
';
+
+ $(document).on("submit", "#ck-mail-news-letter-form", function(e){
+ e.preventDefault();
+
+ var $form = $(this),
+ name = $form.find('input[name="ck_mail_subscriber_name"]').val(),
+ email = $form.find('input[name="ck_mail_subscriber_email"]').val();
+ website = $form.find('input[name="ck_mail_subscriber_website"]').val();
+
+ $.post(ck_mail_localize_data.ajax_url,
+ {action:'ck_mail_subscribe_to_news_letter',
+ ck_mail_security_nonce:ck_mail_localize_data.ck_mail_security_nonce,
+ name:name, email:email, website:website },
+ function(data) {
+
+ if(data)
+ {
+ if(data=="Some fields are missing.")
+ {
+ $("#ck-mail-news-letter-status").text("");
+ $("#ck-mail-news-letter-status").css("color", "red");
+ }
+ else if(data=="Invalid email address.")
+ {
+ $("#ck-mail-news-letter-status").text("");
+ $("#ck-mail-news-letter-status").css("color", "red");
+ }
+ else if(data=="Invalid list ID.")
+ {
+ $("#ck-mail-news-letter-status").text("");
+ $("#ck-mail-news-letter-status").css("color", "red");
+ }
+ else if(data=="Already subscribed.")
+ {
+ $("#ck-mail-news-letter-status").text("");
+ $("#ck-mail-news-letter-status").css("color", "red");
+ }
+ else
+ {
+ $("#ck-mail-news-letter-status").text("You're subscribed!");
+ $("#ck-mail-news-letter-status").css("color", "green");
+ }
+ }
+ else
+ {
+ alert("Sorry, unable to subscribe. Please try again later!");
+ }
+ }
+ );
+ });
+
+ var setup;
+ var wp_pointers_tour_opts = {
+ content:content,
+ position:{
+ edge:"top",
+ align:"left"
+ }
+ };
+
+ wp_pointers_tour_opts = $.extend (wp_pointers_tour_opts, {
+ buttons: function (event, t) {
+ button= jQuery ('' + ck_mail_localize_data.button1 + ' ');
+ button_2= jQuery ('#pointer-close.button');
+ button.bind ('click.pointer', function () {
+ t.element.pointer ('close');
+ });
+ button_2.on('click', function() {
+ setTimeout(function(){
+ t.element.pointer ('close');
+ }, 3000);
+
+ } );
+ return button;
+ },
+ close: function () {
+ $.post (ck_mail_localize_data.ajax_url, {
+ pointer: 'ck_mail_subscribe_pointer',
+ action: 'dismiss-wp-pointer'
+ });
+ },
+ show: function(event, t){
+ t.pointer.css({'left':'170px', 'top':'360px'});
+ }
+ });
+ setup = function () {
+ $(ck_mail_localize_data.displayID).pointer(wp_pointers_tour_opts).pointer('open');
+ if (ck_mail_localize_data.button2) {
+ jQuery ('#pointer-close').after ('' + ck_mail_localize_data.button2+ ' ');
+ jQuery ('#pointer-primary').click (function () {
+ ck_mail_localize_data.function_name;
+ });
+ jQuery ('#pointer-close').click (function () {
+ $.post (ck_mail_localize_data.ajax_url, {
+ pointer: 'ck_mail_subscribe_pointer',
+ action: 'dismiss-wp-pointer'
+ });
+ });
+ }
+ };
+ if (wp_pointers_tour_opts.position && wp_pointers_tour_opts.position.defer_loading) {
+ $(window).bind('load.wp-pointers', setup);
+ }
+ else {
+ setup ();
+ }
+
+ }
+});
\ No newline at end of file
diff --git a/assets/js/admin/ck_mail-newsletter-script.min.js b/assets/js/admin/ck_mail-newsletter-script.min.js
new file mode 100644
index 0000000..93c771b
--- /dev/null
+++ b/assets/js/admin/ck_mail-newsletter-script.min.js
@@ -0,0 +1 @@
+jQuery(document).ready(function(e){if(ck_mail_localize_data.do_tour){var t,i=""+ck_mail_localize_data.using_ck_mail+" ";i+=""+ck_mail_localize_data.do_you_want+" "+ck_mail_localize_data.ck_mail_update+" "+ck_mail_localize_data.before_others+"
",i+='",i+='",e(document).on("submit","#ck-mail-news-letter-form",function(t){t.preventDefault();var i=e(this),n=i.find('input[name="ck_mail_subscriber_name"]').val(),s=i.find('input[name="ck_mail_subscriber_email"]').val();website=i.find('input[name="ck_mail_subscriber_website"]').val(),e.post(ck_mail_localize_data.ajax_url,{action:"ck_mail_subscribe_to_news_letter",ck_mail_security_nonce:ck_mail_localize_data.ck_mail_security_nonce,name:n,email:s,website:website},function(t){t?"Some fields are missing."==t?(e("#ck-mail-news-letter-status").text(""),e("#ck-mail-news-letter-status").css("color","red")):"Invalid email address."==t?(e("#ck-mail-news-letter-status").text(""),e("#ck-mail-news-letter-status").css("color","red")):"Invalid list ID."==t?(e("#ck-mail-news-letter-status").text(""),e("#ck-mail-news-letter-status").css("color","red")):"Already subscribed."==t?(e("#ck-mail-news-letter-status").text(""),e("#ck-mail-news-letter-status").css("color","red")):(e("#ck-mail-news-letter-status").text("You're subscribed!"),e("#ck-mail-news-letter-status").css("color","green")):alert("Sorry, unable to subscribe. Please try again later!")})});var n={content:i,position:{edge:"top",align:"left"}};n=e.extend(n,{buttons:function(e,t){return button=jQuery(''+ck_mail_localize_data.button1+" "),button_2=jQuery("#pointer-close.button"),button.bind("click.pointer",function(){t.element.pointer("close")}),button_2.on("click",function(){setTimeout(function(){t.element.pointer("close")},3e3)}),button},close:function(){e.post(ck_mail_localize_data.ajax_url,{pointer:"ck_mail_subscribe_pointer",action:"dismiss-wp-pointer"})},show:function(e,t){t.pointer.css({left:"170px",top:"360px"})}}),t=function(){e(ck_mail_localize_data.displayID).pointer(n).pointer("open"),ck_mail_localize_data.button2&&(jQuery("#pointer-close").after(''+ck_mail_localize_data.button2+" "),jQuery("#pointer-primary").click(function(){ck_mail_localize_data.function_name}),jQuery("#pointer-close").click(function(){e.post(ck_mail_localize_data.ajax_url,{pointer:"ck_mail_subscribe_pointer",action:"dismiss-wp-pointer"})}))},n.position&&n.position.defer_loading?e(window).bind("load.wp-pointers",t):t()}});
\ No newline at end of file
diff --git a/assets/js/admin/export-logs.js b/assets/js/admin/export-logs.js
new file mode 100644
index 0000000..38591e7
--- /dev/null
+++ b/assets/js/admin/export-logs.js
@@ -0,0 +1,92 @@
+jQuery(document).ready(function($){
+ /** Display date picker on modal window
+ * @since 1.0.11
+ * */
+ $(function() {
+ $("body").delegate("#ck-mail-exp-from-date, #ck-mail-exp-to-date", "focusin", function(){
+ $(this).datepicker({
+ changeMonth: true,
+ changeYear: true,
+ dateFormat: 'yy-mm-dd',
+ maxDate: new Date()
+ });
+ });
+ });
+
+ /** On change of date range
+ * @since 1.0.11
+ * */
+ $(document).on('change', '.ck-mail-exp-date-radio', function(e){
+ let radioVal = $(this).val();
+ if(radioVal == 'custom'){
+ $('#ck-mail-exp-c-date-wrapper').show();
+ }else{
+ $('#ck-mail-exp-c-date-wrapper').hide();
+ }
+ });
+
+ $(document).on('click', '#ck-mail-export-logs-btn', function(e){
+ e.preventDefault();
+
+ let logFlag = ck_mail_validate_logs();
+
+ if(logFlag == 1){
+ $('#ck-mail-export-form').submit();
+ }
+ });
+
+ $(document).on('change', '.ck-mail-comm-info-chk', function(e){
+ if($(this).is(':checked')){
+ $('#ck-mail-fields-error').hide();
+ $('.ck-mail-comm-info-chk').css('border', '1px solid #8c8f94');
+ }
+ });
+
+ function ck_mail_validate_logs() {
+ let validateFlag = 1;
+ let fieldsChkFlag = 0;
+ $.each($('.ck-mail-comm-info-chk'), function(i){
+ if($(this).is(':checked')){
+ fieldsChkFlag = 1;
+ }
+ });
+
+ if(fieldsChkFlag == 0){
+
+ $('#ck-mail-fields-error').show();
+ $('#ck-mail-fields-error').text('Please check atleast one of the fields');
+ $('.ck-mail-comm-info-chk').css('border', '2px solid red');
+ validateFlag = 0;
+
+ }else if($('#ck-mail-exp-date-custom').is(':checked')){
+
+ let fromDate = $('#ck-mail-exp-from-date').val();
+ let toDate = $('#ck-mail-exp-to-date').val();
+
+ if(fromDate.length == 0 && toDate.length == 0){
+
+ $('#ck-mail-exp-date-error').show();
+ $('#ck-mail-exp-date-error').text('Please select from and to date');
+ $('#ck-mail-exp-from-date').focus();
+ validateFlag = 0;
+
+ }else if(fromDate.length == 0){
+
+ $('#ck-mail-exp-date-error').show();
+ $('#ck-mail-exp-date-error').text('Please select from date');
+ $('#ck-mail-exp-from-date').focus();
+ validateFlag = 0;
+
+ }else if(toDate.length == 0){
+
+ $('#ck-mail-exp-date-error').show();
+ $('#ck-mail-exp-date-error').text('Please select to date');
+ $('#ck-mail-exp-to-date').focus();
+ validateFlag = 0;
+
+ }
+
+ }
+ return validateFlag;
+ }
+});
\ No newline at end of file
diff --git a/assets/js/admin/feedback.js b/assets/js/admin/feedback.js
new file mode 100644
index 0000000..52d4475
--- /dev/null
+++ b/assets/js/admin/feedback.js
@@ -0,0 +1,92 @@
+var strict;
+
+jQuery(document).ready(function ($) {
+ /**
+ * DEACTIVATION FEEDBACK FORM
+ */
+ ck_mail_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="check-email"] .row-actions .deactivate a');
+ // show overlay when clicked on "deactivate"
+ ck_mail_deactivate_link_url = ck_mail_deactivate_link.attr('href');
+
+ ck_mail_deactivate_link.click(function (e) {
+ e.preventDefault();
+ // only show feedback form once per 30 days
+ var c_value = ck_mail_admin_get_cookie("ck_mail_hide_deactivate_feedback");
+
+ if (c_value === undefined) {
+ $('#ck-mail-reloaded-feedback-overlay').show();
+ } else {
+ // click on the link
+ window.location.href = ck_mail_deactivate_link_url;
+ }
+ });
+ // show text fields
+ $('#ck-mail-reloaded-feedback-content input[type="radio"]').click(function () {
+ // show text field if there is one
+ var elementText = $(this).parents('li').next('li').children('input[type="text"], textarea');
+ $(this).parents('ul').find('input[type="text"], textarea').not(elementText).hide().val('').attr('required', false);
+ elementText.attr('required', 'required').show();
+ });
+ // send form or close it
+ $('#ck-mail-reloaded-feedback-content form').submit(function (e) {
+ e.preventDefault();
+
+ ck_mail_set_feedback_cookie();
+
+ // Send form data
+ $.post(ajaxurl, {
+ action: 'ck_mail_send_feedback',
+ data: $('#ck-mail-reloaded-feedback-content form').serialize() + "&ck_mail_security_nonce=" + cn_ck_mail_admin_data.ck_mail_security_nonce
+ },
+ function (data) {
+
+ if (data == 'sent') {
+ // deactivate the plugin and close the popup
+ $('#ck-mail-reloaded-feedback-overlay').remove();
+ window.location.href = ck_mail_deactivate_link_url;
+ } else {
+ console.log('Error: ' + data);
+ alert(data);
+ }
+ }
+ );
+ });
+
+ $("#ck-mail-reloaded-feedback-content .ck-mail-feedback-only-deactivate").click(function (e) {
+ e.preventDefault();
+
+ ck_mail_set_feedback_cookie();
+
+ $('#ck-mail-reloaded-feedback-overlay').remove();
+ window.location.href = ck_mail_deactivate_link_url;
+ });
+
+ // close form without doing anything
+ $('.ck-mail-feedback-not-deactivate').click(function (e) {
+ $('#ck-mail-reloaded-feedback-content form')[0].reset();
+ var elementText = $('#ck-mail-reloaded-feedback-content input[type="radio"]').parents('li').next('li').children('input[type="text"], textarea');
+ $(elementText).parents('ul').find('input[type="text"], textarea').hide().val('').attr('required', false);
+ $('#ck-mail-reloaded-feedback-overlay').hide();
+ });
+
+ function ck_mail_admin_get_cookie(name) {
+ var i, x, y, ck_mail_cookies = document.cookie.split(";");
+ for (i = 0; i < ck_mail_cookies.length; i++)
+ {
+ x = ck_mail_cookies[i].substr(0, ck_mail_cookies[i].indexOf("="));
+ y = ck_mail_cookies[i].substr(ck_mail_cookies[i].indexOf("=") + 1);
+ x = x.replace(/^\s+|\s+$/g, "");
+ if (x === name)
+ {
+ return unescape(y);
+ }
+ }
+ }
+
+ function ck_mail_set_feedback_cookie() {
+ // set cookie for 30 days
+ var exdate = new Date();
+ exdate.setSeconds(exdate.getSeconds() + 2592000);
+ document.cookie = "ck_mail_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/";
+ }
+});
\ No newline at end of file
diff --git a/changelog.txt b/changelog.txt
index f28e356..9e95cc8 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,16 @@
== Changelog ==
+= v1.0.12 - 29/05/2024 =
+- Feature: Feature to export logs #49
+- Feature: Added feedback form on plugin deactivation #61
+- Enhancement: Added settings link on plugin dashboard #62
+- Feature: Added Newsletter Form #64
+- Feature: Added Trigger Data (Premium) #65
+- Feature: Added SMTP feature to configure email #66
+
+= v1.0.11 - 16/05/2024 =
+- Fixed: Tested with new version of wordpress i.e. 6.5v
+
= v1.0.10 - 14/03/2024 =
- Fixed: Resolved security issue raised by Wordfence
diff --git a/check-email.php b/check-email.php
index f25ba7b..4f1dbbd 100644
--- a/check-email.php
+++ b/check-email.php
@@ -3,7 +3,7 @@
* Plugin Name: Check & Log Email
* Description: Check & Log email allows you to test if your WordPress installation is sending emails correctly and logs every email.
* Author: checkemail
-* Version: 1.0.10
+* Version: 1.0.12
* Author URI: https://check-email.tech/
* License: GPLv3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -36,6 +36,19 @@
*/
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
+define( 'CK_MAIL_TOC_DIR_NAME', plugin_basename( dirname( __FILE__ ) ) );
+define( 'CK_MAIL_TOC_BASE_NAME', plugin_basename( __FILE__ ) );
+define( 'CK_MAIL_PATH', dirname( __FILE__ ) );
+define( 'CK_MAIL_URL', plugin_dir_url( __FILE__ ) );
+define( 'CK_MAIL_VERSION', '1.0.12' );
+
+if ( is_admin() ) {
+
+ require_once(CK_MAIL_PATH. "/include/helper-function.php" );
+ require_once(CK_MAIL_PATH. "/include/class-check-email-newsletter.php" );
+}
+
+
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
function check_email_compatibility_notice() {
?>
@@ -92,6 +105,7 @@ function check_email_log( $plugin_file ) {
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Logger() );
$check_email->add_loadie( new \CheckEmail\Core\Check_Email_Review() );
+ $check_email->add_loadie( new \CheckEmail\Core\Check_Email_Export_Log() );
$check_email->add_loadie( new \CheckEmail\Core\UI\Check_Email_UI_Loader() );
$check_email->add_loadie( new \CheckEmail\Core\Request\Check_Email_Nonce_Checker() );
@@ -117,4 +131,38 @@ function wpchill_check_email() {
return $check_email;
}
-check_email_log( __FILE__ );
\ No newline at end of file
+check_email_log( __FILE__ );
+
+
+/**
+ * Add settings link to plugin actions
+ *
+ * @param array $plugin_actions
+ * @param string $plugin_file
+ * @since 1.0.11
+ * @return array
+ */
+function check_email_add_plugin_link( $links ) {
+
+ $url = add_query_arg( 'page', 'check-email-settings', self_admin_url( 'admin.php' ) );
+ $setting_link = '' . __( 'Settings', 'check-email' ) . ' |';
+ $setting_link .= '' . __( ' Support', 'check-email' ) . ' ';
+ array_push( $links, $setting_link );
+ return $links;
+}
+add_filter( 'plugin_action_links_'.plugin_basename(__FILE__), 'check_email_add_plugin_link', 10, 2 );
+
+function checkMail_is_plugins_page() {
+
+ if(function_exists('get_current_screen')){
+ $screen = get_current_screen();
+ if(is_object($screen)){
+ if($screen->id == 'plugins' || $screen->id == 'plugins-network'){
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+require_once 'Check_Email_SMTP_Tab.php';
\ No newline at end of file
diff --git a/include/Core/Check_Email_Export_Log.php b/include/Core/Check_Email_Export_Log.php
new file mode 100644
index 0000000..bf0a9b8
--- /dev/null
+++ b/include/Core/Check_Email_Export_Log.php
@@ -0,0 +1,448 @@
+separator = ',';
+
+ add_action('wp_ajax_ck_mail_export_logs', array($this, 'ck_mail_export_logs'));
+ add_action('wp_ajax_ck_email_export_filter_popup', array($this, 'ck_email_export_filter_popup'));
+ }
+
+ /**
+ * Export email logs to csv file
+ * @since 1.0.11
+ * */
+ public function ck_mail_export_logs(){
+
+ if(!isset($_GET['ck_mail_export_nonce'])){
+ wp_die( -1 );
+ }
+
+ if ( !wp_verify_nonce( $_GET['ck_mail_export_nonce'], 'ck_mail_ajax_check_nonce' ) ){
+ wp_die( -1 );
+ }
+
+ if ( ! current_user_can( 'manage_check_email' ) ) {
+ wp_die( -1 );
+ }
+
+ $file_format = 'csv';
+ $file_name = 'email_logs.csv';
+
+ if(isset($_GET['export_type']) && !empty($_GET['export_type'])){
+ $file_format = sanitize_text_field($_GET['export_type']);
+ }
+
+ switch($file_format){
+ case 'csv':
+ $this->separator = ',';
+ $file_name = 'email_logs.csv';
+ header("Content-type: application/csv");
+ break;
+
+ case 'xls':
+ $this->separator = "\t";
+ $file_name = 'email_logs.xls';
+ header('Content-Type: application/vnd.ms-excel');
+ break;
+
+ case 'xlsx':
+ $this->separator = "\t";
+ $file_name = 'email_logs.xlsx';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ break;
+
+ case 'txt':
+ $this->separator = "\t";
+ $file_name = 'email_logs.txt';
+ header('Content-Type: text/plain');
+ break;
+
+ default:
+ $this->separator = ',';
+ $file_name = 'email_logs.csv';
+ header('Content-type: application/csv');
+ break;
+ }
+
+ header("Content-disposition: attachment; filename=\"$file_name\"");
+
+ $fields = array();
+ if(isset($_GET['common_information']) && is_array($_GET['common_information'])){
+ $fields = array_map('sanitize_text_field',$_GET['common_information']);
+ }
+
+ $status = 'All';
+ if(isset($_GET['export_status']) && !empty($_GET['export_status'])){
+ $status = sanitize_text_field($_GET['export_status']);
+ }
+
+ $export_date = 'all';
+ if(isset($_GET['export_date']) && !empty($_GET['export_date'])){
+ $export_date = sanitize_text_field($_GET['export_date']);
+ }
+
+ $from_date = date('Y-m-d 00:00:00');
+ $to_date = date('Y-m-d 23:59:59');
+
+ if($export_date == 'custom'){
+ if(isset($_GET['ck_mail_exp_from_date']) && !empty($_GET['ck_mail_exp_from_date'])){
+ $from_date = date('Y-m-d 00:00:00', strtotime(sanitize_text_field($_GET['ck_mail_exp_from_date'])));
+ }
+ if(isset($_GET['ck_mail_exp_to_date']) && !empty($_GET['ck_mail_exp_to_date'])){
+ $to_date = date('Y-m-d 23:59:59', strtotime(sanitize_text_field($_GET['ck_mail_exp_to_date'])));
+ }
+ }
+
+ $export_recipient = '';
+ if(isset($_GET['export_recipient']) && !empty($_GET['export_recipient'])){
+ $export_recipient = sanitize_text_field($_GET['export_recipient']);
+ }
+
+
+ if(!empty($fields)){
+ $logs = $this->ck_mail_generate_csv($fields, $status, $export_date, $from_date, $to_date, $export_recipient, $file_format);
+ echo $logs;
+ }
+
+ wp_die();
+ }
+
+ /**
+ * Generate email log
+ * @since 1.0.11
+ * */
+ public function ck_mail_generate_csv($fields, $status, $export_date, $from_date, $to_date, $export_recipient, $file_format){
+ global $wpdb;
+
+ $table_name = $wpdb->prefix.'check_email_log';
+
+ $query = $wpdb->prepare("SELECT * FROM $table_name");
+ if($status == 'All' && $export_date == 'all'){
+ if(!empty($export_recipient)){
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE to_email = %s", $export_recipient);
+ }else{
+ $query = $wpdb->prepare("SELECT * FROM $table_name");
+ }
+ }else if($status == 'Success' && $export_date == 'all'){
+ if(!empty($export_recipient)){
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE (error_message = %s OR error_message IS NULL) AND to_email = %s", $status, $export_recipient);
+ }else{
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE error_message = %s OR error_message IS NULL", $status);
+ }
+ }else if($status == 'Fail' && $export_date == 'all'){
+ if(!empty($export_recipient)){
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE error_message != %s AND to_email = %s", 'Success', $export_recipient);
+ }else{
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE error_message != %s", 'Success');
+ }
+ }else if($status == 'All' && $export_date == 'custom'){
+ if(!empty($export_recipient)){
+ $query = $query = $wpdb->prepare("SELECT * FROM $table_name WHERE to_email = %s AND sent_date BETWEEN %s AND %s", $export_recipient, $from_date, $to_date);
+ }else{
+ $query = $query = $wpdb->prepare("SELECT * FROM $table_name WHERE sent_date BETWEEN %s AND %s", $from_date, $to_date);
+ }
+ }else if($status == 'Success' && $export_date == 'custom'){
+ if(!empty($export_recipient)){
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE (error_message = %s OR error_message IS NULL) AND to_email = %s AND sent_date BETWEEN %s AND %s", $status, $export_recipient, $from_date, $to_date);
+ }else{
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE (error_message = %s OR error_message IS NULL) AND sent_date BETWEEN %s AND %s", $status, $from_date, $to_date);
+ }
+ }else if($status == 'Fail' && $export_date == 'custom'){
+ if(!empty($export_recipient)){
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE error_message != %s AND to_email = %s AND sent_date BETWEEN %s AND %s", 'Success', $export_recipient, $from_date, $to_date);
+ }else{
+ $query = $wpdb->prepare("SELECT * FROM $table_name WHERE error_message != %s AND sent_date BETWEEN %s AND %s", 'Success', $from_date, $to_date);
+ }
+ }
+
+ $results = $wpdb->get_results($query, ARRAY_A);
+
+ $logs_data = '';
+ $csv_headings = array('Sr No');
+ $csv_headings = array_merge($csv_headings, $fields);
+
+ $logs_data = implode($this->separator, $csv_headings);
+ if($file_format == 'txt'){
+ $logs_data = implode("\t \t", $csv_headings);
+ }
+ $logs_data .= "\n";
+
+ if( !empty($results) && is_array($results) && !empty($results) ){
+ $log_cnt = 1;
+ foreach ( $results as $l_key => $l_value ) {
+ if( !empty($l_value) && is_array($l_value) ){
+
+ $logs_data .= $log_cnt.$this->separator;
+
+ if(in_array("From", $csv_headings)){
+ $from = '';
+ if ( function_exists('imap_rfc822_parse_headers' ) ) {
+ $headers = imap_rfc822_parse_headers($l_value['headers']);
+
+ if (isset($headers->fromaddress) && !empty($headers->fromaddress)) {
+ $from = $headers->fromaddress;
+ $from = apply_filters( 'check_email_log_list_column_from_email', esc_html( $from ) );
+ }
+ }else {
+ $find_from = substr($l_value['headers'], strpos($l_value['headers'], 'From') + 5 );
+
+ if(!empty($find_from) && is_string($find_from)){
+ $find_from = explode("\n", $find_from);
+ if(is_array($find_from) && isset($find_from[1])){
+ $from = $find_from[1];
+ }
+ }
+ }
+
+ $logs_data .= $from.$this->separator;
+ }
+
+ if(in_array("To", $csv_headings)){
+ $logs_data .= $l_value['to_email'].$this->separator;
+ }
+
+ if(in_array("Subject", $csv_headings)){
+ $logs_data .= $l_value['subject'].$this->separator;
+ }
+
+ if(in_array("Message", $csv_headings)){
+ $message = str_replace(',', '', $l_value['message']);
+ $message = preg_replace('~[\r\n\t]+~', '', $message);
+ $logs_data .= $message.$this->separator;
+ }
+
+ if(in_array("Sent At", $csv_headings)){
+ $logs_data .= date('d-m-Y H:i:s', strtotime($l_value['sent_date'])).$this->separator;
+ }
+ if(in_array("Status", $csv_headings)){
+ $logs_data .= empty($l_value['error_message'])?'Success':$l_value['error_message'];
+ }
+
+ $log_cnt++;
+
+ $logs_data .= " \n ";
+ }
+ }
+ }
+ return $logs_data;
+ }
+
+ /**
+ * Template for email log options
+ * @since 1.0.11
+ * */
+ public function ck_email_export_filter_popup(){
+ if ( ! current_user_can( 'manage_check_email' ) ) {
+ wp_die( -1 );
+ }
+
+ if ( ! isset( $_GET['ck_mail_security_nonce'] ) ){
+ wp_die( '-1' );
+ }
+
+ if ( !wp_verify_nonce( $_GET['ck_mail_security_nonce'], 'ck_mail_ajax_check_nonce' ) ){
+ wp_die( '-1' );
+ }
+ ?>
+
+
+
+ ck_mail_get_backtrace();
+ if(!empty($backtrace_segment) && is_array($backtrace_segment)){
+ $backtrace_segment = json_encode($backtrace_segment);
+ }else{
+ $backtrace_segment = null;
+ }
+
$log = array(
'to_email' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['to'] ),
'subject' => esc_html($mail_info['subject']),
'message' => wp_kses_post($mail_info['message']),
+ 'backtrace_segment'=> $backtrace_segment,
'headers' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['headers'], "\n" ),
'attachment_name' => \CheckEmail\Util\wp_chill_check_email_stringify( $mail_info['attachments'] ),
'sent_date' => current_time( 'mysql' ),
@@ -69,6 +78,26 @@ public function log_email( $original_mail_info ) {
return $original_mail_info;
}
+
+ /**
+ * Get the details of the method that originally triggered wp_mail
+ *
+ * @return array a single element of the debug_backtrace function
+ * @since 1.0.12
+ */
+ private function ck_mail_get_backtrace($functionName = 'wp_mail')
+ {
+ $backtraceSegment = null;
+ $backtrace = debug_backtrace();
+
+ foreach ($backtrace as $segment) {
+ if ($segment['function'] == $functionName) {
+ $backtraceSegment = $segment;
+ }
+ }
+
+ return $backtraceSegment;
+ }
public function on_email_failed( $wp_error ) {
if ( ! is_wp_error( $wp_error ) ) {
diff --git a/include/Core/DB/Check_Email_Table_Manager.php b/include/Core/DB/Check_Email_Table_Manager.php
index 249b587..d2855f9 100644
--- a/include/Core/DB/Check_Email_Table_Manager.php
+++ b/include/Core/DB/Check_Email_Table_Manager.php
@@ -29,6 +29,8 @@ public function load() {
add_action( 'wpmu_new_blog', array( $this, 'create_table_for_new_blog' ) );
add_filter( 'wpmu_drop_tables', array( $this, 'delete_table_from_deleted_blog' ) );
+
+ add_filter( 'admin_init', array( $this, 'add_backtrace_segment_field' ) );
// Do any DB upgrades.
$this->update_table_if_needed();
@@ -371,6 +373,7 @@ private function get_create_table_query() {
to_email VARCHAR(500) NOT NULL,
subject VARCHAR(500) NOT NULL,
message TEXT NOT NULL,
+ backtrace_segment TEXT NOT NULL,
headers TEXT NOT NULL,
attachments TEXT NOT NULL,
sent_date timestamp NOT NULL,
@@ -426,4 +429,29 @@ public function query_log_items_by_column( $columns ) {
return $wpdb->get_results( $query );
}
}
+
+ /**
+ * Add new backtrace_segment field to check_email_log table
+ * @since 1.0.12
+ * */
+ public function add_backtrace_segment_field(){
+ global $wpdb;
+ $table_name = $this->get_log_table_name();
+
+ // Field to check
+ $field_name = 'backtrace_segment';
+
+ // Query to check if the field exists in the table
+ $field_exists = $wpdb->get_results(
+ $wpdb->prepare(
+ "SHOW COLUMNS FROM $table_name LIKE %s",
+ $field_name
+ )
+ );
+
+ if(empty($field_exists)){
+ $query = "ALTER TABLE $table_name ADD backtrace_segment TEXT NULL DEFAULT NULL AFTER message";
+ $wpdb->query($query);
+ }
+ }
}
diff --git a/include/Core/Request/Check_Email_Log_List_Action.php b/include/Core/Request/Check_Email_Log_List_Action.php
index aaa2161..7037f54 100644
--- a/include/Core/Request/Check_Email_Log_List_Action.php
+++ b/include/Core/Request/Check_Email_Log_List_Action.php
@@ -71,6 +71,7 @@ public function view_log_message() {
@@ -80,6 +81,19 @@ public function view_log_message() {
check_email_kses_allowed_html( 'post' ) ); ?>
+
+
-
+ add_loadie( new \CheckEmail\Core\UI\Setting\Check_Email_Tools_Tab() );
+ elseif('license' == $tab):
+ do_action('ck_mail_add_license_tab_content', );
+ ?>
+
+
-
+
diff --git a/include/Core/UI/Page/Check_Email_UpgradeToPro_Page.php b/include/Core/UI/Page/Check_Email_UpgradeToPro_Page.php
new file mode 100644
index 0000000..dab7aa2
--- /dev/null
+++ b/include/Core/UI/Page/Check_Email_UpgradeToPro_Page.php
@@ -0,0 +1,41 @@
+page = add_submenu_page(
+ Check_Email_Status_Page::PAGE_SLUG,
+ esc_html__( 'Upgrade To Pro', 'check-email' ),
+ ''.esc_html__( 'Upgrade To Pro', 'check-email' ).' ',
+ 'manage_check_email',
+ self::PAGE_SLUG,
+ array( $this, 'render_page' )
+ );
+ }
+
+ public function render_page() {
+ wp_redirect( 'https://check-email.tech/pricing/#pricings' );
+ exit;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/include/Core/UI/Setting/Check_Email_Core_Setting.php b/include/Core/UI/Setting/Check_Email_Core_Setting.php
index 72373b4..4004ffa 100644
--- a/include/Core/UI/Setting/Check_Email_Core_Setting.php
+++ b/include/Core/UI/Setting/Check_Email_Core_Setting.php
@@ -15,13 +15,14 @@ protected function initialize() {
$this->section->field_labels = array(
'allowed_user_roles' => esc_html__( 'Allowed User Roles', 'check-email' ),
- 'remove_on_uninstall' => esc_html__( 'Remove Data on Uninstall?', 'check-email' ),
- 'override_emails_from' => esc_html__( 'Override Emails From', 'check-email' ),
+ 'remove_on_uninstall' => ''.esc_html__( 'Remove Data on Uninstall?', 'check-email' ).' ',
+ 'override_emails_from' => ''.esc_html__( 'Override Emails From', 'check-email' ).' ',
'email_from_name' => esc_html__( 'Change the "from" name.', 'check-email' ),
'email_from_email' => esc_html__( 'Change the "from" email.', 'check-email' ),
- 'enable_logs' => esc_html__( 'Enable Logs', 'check-email' ),
- 'enable_dashboard_widget' => esc_html__( 'Enable Dashboard Widget', 'check-email' ),
- 'db_size_notification' => esc_html__( 'Database Size Notification', 'check-email' ),
+ 'enable_logs' => ''.esc_html__( 'Enable Logs', 'check-email' ).' ',
+ 'enable_dashboard_widget' => ''.esc_html__( 'Enable Dashboard Widget', 'check-email' ).' ',
+ 'db_size_notification' => ''.esc_html__( 'Database Size Notification', 'check-email' ).' ',
+ 'trigger_data' => ''.esc_html__( 'Triggered Data', 'check-email' ).' ',
);
$this->section->default_value = array(
@@ -38,7 +39,8 @@ protected function initialize() {
'logs_threshold' => '',
'log_threshold_met' => false,
'threshold_email_last_sent' => false,
- )
+ ),
+ 'trigger_data' => true,
);
$this->load();
@@ -119,7 +121,7 @@ public function render_remove_on_uninstall_settings( $args ) {
$field_name = $this->section->option_name . '[' . $args['id'] . ']';
?>
- >
+ >
get_value();
+ $trigger_data = $option[ $args['id'] ];
+
+ $field_name = $this->section->option_name . '[' . $args['id'] . ']';
+
+ if(!defined('CK_MAIL_PRO_VERSION')){
+ ?>
+
+
+
+
+ >
+
+ load_tools_settings();
+ }
+
+ public function load_tools_settings(){
+ $check_email = wpchill_check_email();
+ $plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
+
+ add_thickbox();
+
+ wp_enqueue_style( 'check-email-export-logs-css', $plugin_dir_url . 'assets/css/admin/export-logs.css', array( 'jquery-ui-css' ), $check_email->get_version() );
+
+ ?>
+
+ get_plugin_file() );
+
+ wp_enqueue_script( 'check-email-export-logs', $plugin_dir_url . 'assets/js/admin/export-logs.js', array( 'insertionQ', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-tooltip', 'jquery-ui-tabs' ), $check_email->get_version(), true );
+ }
+
+}
diff --git a/include/Core/UI/list_table/Check_Email_Log_List_Table.php b/include/Core/UI/list_table/Check_Email_Log_List_Table.php
index 430261d..f014751 100644
--- a/include/Core/UI/list_table/Check_Email_Log_List_Table.php
+++ b/include/Core/UI/list_table/Check_Email_Log_List_Table.php
@@ -215,8 +215,31 @@ public function search_box( $text, $input_id ) {
:
- 'search-submit' ) ); ?>
+ 'search-submit' ) );
+ $this->ck_mail_export_logs_button();
+ ?>
'ck_email_export_filter_popup',
+ 'width' => '800',
+ 'height' => '550',
+ 'ck_mail_security_nonce' => wp_create_nonce( 'ck_mail_ajax_check_nonce' )
+ ),
+ 'admin-ajax.php'
+ );
+ echo sprintf( '%3$s ',
+ esc_url( $logs_ajax_url ),
+ esc_html__( 'Export Log Options', 'check-email' ),
+ esc_html__( 'Export Logs', 'check-email' )
+ );
+ }
}
diff --git a/include/class-check-email-newsletter.php b/include/class-check-email-newsletter.php
new file mode 100644
index 0000000..7f30051
--- /dev/null
+++ b/include/class-check-email-newsletter.php
@@ -0,0 +1,124 @@
+ esc_html__( 'Thanks for using Check & Log Email!', 'check-email' ),
+ 'do_you_want' => esc_html__( 'Do you want the latest updates on ', 'check-email' ),
+ 'ck_mail_update' => esc_html__( 'Check & Log Email update', 'check-email' ),
+ 'before_others' => esc_html__( ' before others and some best resources on monetization in a single email? - Free just for users of Check & Log Email!', 'check-email' ),
+ 'ck_mail_security_nonce' => wp_create_nonce( 'ck_mail_ajax_check_nonce' ),
+ 'ajax_url' => admin_url( 'admin-ajax.php' )
+ );
+
+ $script_data = apply_filters('ck_mail_localize_filter',$script_data,'ck_mail_localize_data');
+
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+ $check_email = wpchill_check_email();
+ $plugin_dir_url = plugin_dir_url( $check_email->get_plugin_file() );
+
+ wp_register_script( 'ck_mail-newsletter-script', $plugin_dir_url . 'assets/js/admin/ck_mail-newsletter-script' . $suffix . '.js', array( 'jquery' ), CK_MAIL_VERSION );
+ wp_localize_script( 'ck_mail-newsletter-script', 'ck_mail_localize_data', $script_data );
+ wp_enqueue_script( 'ck_mail-newsletter-script' );
+ }
+
+ public function ck_mail_add_localize_footer_data($object, $object_name){
+
+ $dismissed = explode (',', get_user_meta (wp_get_current_user()->ID, 'dismissed_wp_pointers', true));
+ $do_tour = !in_array ('ck_mail_subscribe_pointer', $dismissed);
+
+ if ($do_tour) {
+ wp_enqueue_style ('wp-pointer');
+ wp_enqueue_script ('wp-pointer');
+ }
+
+ if($object_name == 'ck_mail_localize_data'){
+
+ global $current_user;
+ $tour = array ();
+ $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : '';
+
+ if (!array_key_exists($tab, $tour)) {
+
+ $object['do_tour'] = $do_tour;
+ $object['get_home_url'] = get_home_url();
+ $object['current_user_email'] = $current_user->user_email;
+ $object['current_user_name'] = $current_user->display_name;
+ $object['displayID'] = '#toplevel_page_check-email-status';
+ $object['button1'] = esc_html__('No Thanks', 'check-email');
+ $object['button2'] = false;
+ $object['function_name'] = '';
+ }
+
+ }
+ return $object;
+ }
+
+ /**
+ * Process newsletter
+ * @since 1.0.11
+ * */
+ public function ck_mail_subscribe_to_news_letter(){
+ if(!current_user_can( 'manage_options' )){
+ die( '-1' );
+ }
+ if ( ! isset( $_POST['ck_mail_security_nonce'] ) ){
+ die( '-1' );
+ }
+ if ( !wp_verify_nonce( $_POST['ck_mail_security_nonce'], 'ck_mail_ajax_check_nonce' ) ){
+ die( '-1' );
+ }
+
+ $name = isset($_POST['name'])?sanitize_text_field($_POST['name']):'';
+ $email = isset($_POST['email'])?sanitize_text_field($_POST['email']):'';
+ $website = isset($_POST['website'])?sanitize_text_field($_POST['website']):'';
+
+ if($email){
+
+ $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
+
+ $api_params = array(
+ 'name' => $name,
+ 'email' => $email,
+ 'website' => $website,
+ 'type' => 'checkmail'
+ );
+
+ $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
+ $response = wp_remote_retrieve_body( $response );
+ echo $response;
+
+ }else{
+ echo esc_html('Email id required', 'check-email');
+ }
+
+ wp_die();
+ }
+}
+
+new Check_Email_Newsletter();
\ No newline at end of file
diff --git a/include/deactivate-feedback.php b/include/deactivate-feedback.php
new file mode 100644
index 0000000..08e98cc
--- /dev/null
+++ b/include/deactivate-feedback.php
@@ -0,0 +1,48 @@
+user_email );
+}
+
+$reasons = array(
+ 1 => ' ' . __('It is only temporary', 'check-mail') . ' ',
+ 2 => ' ' . __('I stopped using check & log mail on my site', 'check-mail') . ' ',
+ 3 => ' ' . __('I miss a feature', 'check-mail') . '
+ ',
+ 4 => ' ' . __('Technical Issue', 'check-mail') . '
+ ',
+ 5 => ' ' . __('I switched to another plugin', 'check-mail') . '
+ ',
+ 6 => ' ' . __('Other reason', 'check-mail') . '
+ ',
+ );
+shuffle($reasons);
+?>
+
+
+
\ No newline at end of file
diff --git a/include/helper-function.php b/include/helper-function.php
new file mode 100644
index 0000000..5b016ff
--- /dev/null
+++ b/include/helper-function.php
@@ -0,0 +1,156 @@
+id == 'plugins' || $screen->id == 'plugins-network'){
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+add_filter('admin_footer', 'ck_mail_add_deactivation_feedback_modal');
+function ck_mail_add_deactivation_feedback_modal() {
+
+ if( !is_admin() && !ck_mail_is_plugins_page()) {
+ return;
+ }
+
+ require_once CK_MAIL_PATH ."/include/deactivate-feedback.php";
+
+}
+
+/**
+ * send feedback via email
+ *
+ * @since 1.4.0
+ */
+function ck_mail_send_feedback() {
+
+ if( isset( $_POST['data'] ) ) {
+ parse_str( $_POST['data'], $form );
+ }
+
+ if( !isset( $form['ck_mail_security_nonce'] ) || isset( $form['ck_mail_security_nonce'] ) && !wp_verify_nonce( sanitize_text_field( $form['ck_mail_security_nonce'] ), 'ck_mail_ajax_check_nonce' ) ) {
+ echo 'security_nonce_not_verified';
+ die();
+ }
+ if ( !current_user_can( 'manage_options' ) ) {
+ die();
+ }
+
+ $text = '';
+ if( isset( $form['ck_mail_disable_text'] ) ) {
+ $text = implode( " ", $form['ck_mail_disable_text'] );
+ }
+
+ $headers = array();
+
+ $from = isset( $form['ck_mail_disable_from'] ) ? $form['ck_mail_disable_from'] : '';
+ if( $from ) {
+ $headers[] = "From: $from";
+ $headers[] = "Reply-To: $from";
+ }
+
+ $subject = isset( $form['ck_mail_disable_reason'] ) ? $form['ck_mail_disable_reason'] : '(no reason given)';
+
+ if($subject == 'technical issue'){
+
+ $subject = 'Check & Log Email '.$subject;
+ $text = trim($text);
+
+ if(!empty($text)){
+
+ $text = 'technical issue description: '.$text;
+
+ }else{
+
+ $text = 'no description: '.$text;
+ }
+
+ }else{
+ $subject = 'Check & Log Email';
+ }
+
+ $success = wp_mail( 'team@magazine3.in', $subject, $text, $headers );
+
+ echo 'sent';
+ die();
+}
+add_action( 'wp_ajax_ck_mail_send_feedback', 'ck_mail_send_feedback' );
+
+function ck_mail_enqueue_makebetter_email_js(){
+
+ if( !is_admin() && !ck_mail_is_plugins_page()) {
+ return;
+ }
+
+ wp_enqueue_script( 'ck_mail_make_better_js', CK_MAIL_URL . 'assets/js/admin/feedback.js', array( 'jquery' ));
+ $data = array(
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
+ 'ck_mail_security_nonce' => wp_create_nonce('ck_mail_ajax_check_nonce'),
+ );
+
+ $data = apply_filters( 'ck_mail_localize_filter', $data, 'eztoc_admin_data' );
+
+ wp_localize_script( 'ck_mail_make_better_js', 'cn_ck_mail_admin_data', $data );
+
+ wp_enqueue_style( 'ck_mail_make_better_css', CK_MAIL_URL . 'assets/css/admin/feedback.css', false );
+
+
+}
+add_action( 'admin_enqueue_scripts', 'ck_mail_enqueue_makebetter_email_js' );
+
+
+add_action('wp_ajax_ck_mail_subscribe_newsletter','ck_mail_subscribe_for_newsletter');
+function ck_mail_subscribe_for_newsletter(){
+ if( !wp_verify_nonce( sanitize_text_field( $_POST['ck_mail_security_nonce'] ), 'ck_mail_ajax_check_nonce' ) ) {
+ echo 'security_nonce_not_verified';
+ die();
+ }
+ if ( !current_user_can( 'manage_options' ) ) {
+ die();
+ }
+ $api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
+ $api_params = array(
+ 'name' => sanitize_text_field($_POST['name']),
+ 'email'=> sanitize_email($_POST['email']),
+ 'website'=> sanitize_text_field($_POST['website']),
+ 'type'=> 'checkmail'
+ );
+ $response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
+ $response = wp_remote_retrieve_body( $response );
+ echo $response;
+ die;
+}
\ No newline at end of file
diff --git a/include/install.php b/include/install.php
index bf489d6..aef64c2 100644
--- a/include/install.php
+++ b/include/install.php
@@ -54,6 +54,7 @@ private static function create_checkemaillog_table() {
to_email VARCHAR(100) NOT NULL,
subject VARCHAR(250) NOT NULL,
message TEXT NOT NULL,
+ backtrace_segment TEXT NOT NULL,
headers TEXT NOT NULL,
attachments TEXT NOT NULL,
sent_date timestamp NOT NULL,
diff --git a/readme.txt b/readme.txt
index e973f86..fb16b8c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,9 +2,9 @@
Contributors: checkemail
Tags: check, test, email, smtp, delivery
Requires at least: 5.0
-Tested up to: 6.4
+Tested up to: 6.5
Requires PHP: 5.6.20
-Stable tag: 1.0.10
+Stable tag: 1.0.12
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -15,15 +15,19 @@ Check & Log email allows you to test if your WordPress installation is sending e
In need of a tool that allows you to easily log and view all emails sent from WordPress? Check & Log might be just the solution for that.
This WordPress plugin helps you store sent emails for auditing purposes, as well as debug email related problems in your WordPress site. Works best on eCommerce websites that have been created with WooCommerce or Easy Digital Downloads.
-[Home](https://check-email.tech/) | [Help & Tech Support](https://check-email.tech/contact/) | [Documentation](https://check-email.tech/docs/)
+[Home](https://check-email.tech/) | [Help & Tech Support](https://check-email.tech/contact/) | [Documentation](https://check-email.tech/docs/) | [Premium Features](https://check-email.tech/pricing/#pro-feature)
-Some of its features include:
+== Features of the plugin Check & Log Email ==
- Test email sending - if you’re not sure whether WordPress is sending emails, you can use this plugin to find out. The process is very simple: you need to choose an address that will receive a simple test email. You can even override the custom header with your own values, to avoid any other issues.
- Viewing logged emails - they can be viewed from the admin interface, as they are stored in a separate table. You get the option to filter them based on subject, email, date, etc.
- Deleting logged emails - you can delete them by going to the admin interface. You can either delete them in bulk or selectively - by date, email, or subject.
- Ability to change the "mail from" email address, "mail from name" and override default email WordPress addresses.
+== Premium Features of the plugin Check & Log Email ==
+
+- Triggered Data - Triggered data helps you in debugging by showing the exact code that is sending that email
+
Support
We try our best to provide support on WordPress.org forums. However, We have a special [community support](https://check-email.tech/contact/) where you can ask us questions and get help about your Check & Log Email related questions. Delivering a good user experience means a lot to us and so we try our best to reply each and every question that gets asked.
@@ -68,6 +72,17 @@ Someone using one of my other plugins had trouble with emails not being sent. I
== Changelog ==
+= v1.0.12 - 29/05/2024 =
+- Feature: Feature to export logs #49
+- Feature: Added feedback form on plugin deactivation #61
+- Enhancement: Added settings link on plugin dashboard #62
+- Feature: Added Newsletter Form #64
+- Feature: Added Trigger Data (Premium) #65
+- Feature: Added SMTP feature to configure email #66
+
+= v1.0.11 - 16/05/2024 =
+- Fixed: Tested with new version of wordpress i.e. 6.5v
+
= v1.0.10 - 14/03/2024 =
- Fixed: Resolved security issue raised by Wordfence
diff --git a/uninstall.php b/uninstall.php
index 0a636f2..7341479 100644
--- a/uninstall.php
+++ b/uninstall.php
@@ -39,6 +39,8 @@ function check_email_delete_db_data() {
delete_option( 'check-email-log-db' );
delete_option( 'check-email-log-core' );
+ delete_option( 'check-email-smtp-options' );
+ delete_option( 'check_email_smtp_status' );
$roles = get_editable_roles();
foreach ( $roles as $role_name => $role_obj ) {