chart.js
6 days ago
check-mail-jsPdf.js
6 days ago
check_mail_push.js
6 days ago
check_mail_wizard.js
6 days ago
check_mail_wizard.min.js
6 days ago
checkemail.js
6 days ago
checkemail.min.js
6 days ago
checkmail-dashboard-chart.js
6 days ago
checkmail-dashboard-chart.min.js
6 days ago
checkmail-sw.js
6 days ago
ck_mail-newsletter-script.js
6 days ago
ck_mail-newsletter-script.min.js
6 days ago
export-logs.js
6 days ago
export-logs.min.js
6 days ago
feedback.js
6 days ago
feedback.min.js
6 days ago
firebase-app.js
6 days ago
firebase-messaging.js
6 days ago
support-settings.js
6 days ago
support-settings.min.js
6 days ago
view-logs.js
6 days ago
view-logs.min.js
6 days ago
checkemail.js
653 lines
| 1 | /** |
| 2 | * Show/Hide individual add-on license key input. |
| 3 | */ |
| 4 | (function ($) { |
| 5 | $(document).ready(function () { |
| 6 | $(".checkemail-hide").hide(); |
| 7 | var widget = $("#check-email-enable-widget").parent().parent(); |
| 8 | var dbNotifications = $("#check-email-enable-db-notifications") |
| 9 | .parent() |
| 10 | .parent(); |
| 11 | |
| 12 | $("#checkemail_autoheaders,#checkemail_customheaders").on( |
| 13 | "change", |
| 14 | function () { |
| 15 | if ($("#checkemail_autoheaders").is(":checked")) { |
| 16 | $("#customheaders").hide(); |
| 17 | $("#autoheaders").show(); |
| 18 | } |
| 19 | if ($("#checkemail_customheaders").is(":checked")) { |
| 20 | $("#autoheaders").hide(); |
| 21 | $("#customheaders").show(); |
| 22 | } |
| 23 | } |
| 24 | ); |
| 25 | |
| 26 | var from_name_setting = $("#check-email-from_name").parent().parent(); |
| 27 | var from_email_setting = $("#check-email-from_email").parent().parent(); |
| 28 | if (!$("#check-email-overdide-from").is(":checked")) { |
| 29 | from_name_setting.hide(); |
| 30 | from_email_setting.hide(); |
| 31 | } |
| 32 | |
| 33 | $("#check-email-overdide-from").on("click", function () { |
| 34 | if ($(this).is(":checked")) { |
| 35 | from_name_setting.show(); |
| 36 | from_email_setting.show(); |
| 37 | } else { |
| 38 | from_name_setting.hide(); |
| 39 | from_email_setting.hide(); |
| 40 | } |
| 41 | }); |
| 42 | |
| 43 | function activatePlugin(url) { |
| 44 | $.ajax({ |
| 45 | async: true, |
| 46 | type: "GET", |
| 47 | dataType: "html", |
| 48 | url: url, |
| 49 | success: function () { |
| 50 | location.reload(); |
| 51 | }, |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | // Install plugins actions |
| 56 | $("#install_wp_smtp").on("click", (event) => { |
| 57 | event.preventDefault(); |
| 58 | const current = $(event.currentTarget); |
| 59 | const plugin_slug = current.data("slug"); |
| 60 | const plugin_action = current.data("action"); |
| 61 | const activate_url = current.data("activation_url"); |
| 62 | |
| 63 | // Now let's disable the button and show the action text |
| 64 | current.attr("disabled", true); |
| 65 | |
| 66 | if ("install" === plugin_action) { |
| 67 | current.addClass("updating-message"); |
| 68 | |
| 69 | const args = { |
| 70 | slug: plugin_slug, |
| 71 | success: (response) => { |
| 72 | current.html("Activating plugin"); |
| 73 | |
| 74 | activatePlugin(response.activateUrl); |
| 75 | }, |
| 76 | error: (response) => { |
| 77 | current.removeClass("updating-message"); |
| 78 | jQuery("#install_wp_smtp_info p").html(response.errorMessage); |
| 79 | jQuery("#install_wp_smtp_info").addClass("notice-error notice"); |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | wp.updates.installPlugin(args); |
| 84 | } else if ("activate" === plugin_action) { |
| 85 | activatePlugin(activate_url); |
| 86 | } |
| 87 | }); |
| 88 | |
| 89 | /** |
| 90 | * On click of Trigger Data option display link to upgrade to pro |
| 91 | * @since 1.0.11 |
| 92 | * */ |
| 93 | |
| 94 | $(document).on('click', '#check-email-enable-smtp', function(e){ |
| 95 | if($(this).is(':checked')){ |
| 96 | $('.check_email_all_smtp').show(); |
| 97 | }else{ |
| 98 | $('.check_email_all_smtp').hide(); |
| 99 | } |
| 100 | chec_email_manage_display_state(); |
| 101 | }); |
| 102 | $(document).on('click', '#check_mail_resend_btn', function(e){ |
| 103 | t = jQuery(this); |
| 104 | jQuery('.cm_js_error').html(''); |
| 105 | jQuery('.cm_js_success').html(''); |
| 106 | var ajaxurl = jQuery('#cm_ajax_url').val(); |
| 107 | var data = jQuery("#check-mail-resend-form" ).serialize(); |
| 108 | jQuery.ajax({ |
| 109 | url:ajaxurl, |
| 110 | method:'post', |
| 111 | dataType: "json", |
| 112 | data:data, |
| 113 | beforeSend: function(response){ |
| 114 | t.html('Resend<span class="spinner is-active"></span>'); |
| 115 | t.prop('disabled',true); |
| 116 | }, |
| 117 | success:function(response){ |
| 118 | if (response.status != 200) { |
| 119 | jQuery('.cm_js_error').html(response.message); |
| 120 | }else{ |
| 121 | jQuery('.cm_js_success').html(response.message); |
| 122 | location.reload(); |
| 123 | } |
| 124 | }, |
| 125 | complete:function(response){ |
| 126 | t.html('Resend'); |
| 127 | t.prop('disabled',false); |
| 128 | } |
| 129 | }); |
| 130 | }); |
| 131 | |
| 132 | function cm_import_data_in_chunks(ajaxurl,data,t){ |
| 133 | jQuery.ajax({ |
| 134 | url:ajaxurl, |
| 135 | method:'post', |
| 136 | dataType: "json", |
| 137 | data:data, |
| 138 | beforeSend: function(response){ |
| 139 | t.html('Import<span class="spinner is-active"></span>'); |
| 140 | t.prop('disabled',true); |
| 141 | }, |
| 142 | success:function(response){ |
| 143 | if (response.status != 200) { |
| 144 | t.parents('.cm_js_migration').find('.cm_js_error').html(response.message); |
| 145 | }else{ |
| 146 | t.parents('.cm_js_migration').find('.cm_js_success').html(response.message); |
| 147 | } |
| 148 | }, |
| 149 | complete:function(response){ |
| 150 | t.html('Import'); |
| 151 | t.prop('disabled',false); |
| 152 | } |
| 153 | |
| 154 | }); |
| 155 | } |
| 156 | |
| 157 | $(".check-mail-import-plugins").on("click", function(e){ |
| 158 | e.preventDefault(); |
| 159 | jQuery('.cm_js_error').html(''); |
| 160 | jQuery('.cm_js_success').html(''); |
| 161 | var t = $(this); |
| 162 | var plugin_name = $(this).attr('data-id'); |
| 163 | var ajaxurl = jQuery('#cm_ajax_url').attr('data'); |
| 164 | var ck_mail_security_nonce = jQuery('#cm_security_nonce').attr('data'); |
| 165 | data = { action:"check_mail_import_plugin_data", plugin_name:plugin_name, ck_mail_security_nonce:ck_mail_security_nonce}; |
| 166 | cm_import_data_in_chunks(ajaxurl,data,t); |
| 167 | }); |
| 168 | |
| 169 | var forward_email_to = $(".check_email_forward_to"); |
| 170 | var forward_email_cc = $(".check_email_forward_cc"); |
| 171 | var forward_email_bcc = $(".check_email_forward_bcc"); |
| 172 | if (!$("#check-email-forward_email").is(":checked")) { |
| 173 | forward_email_to.hide(); |
| 174 | forward_email_cc.hide(); |
| 175 | forward_email_bcc.hide(); |
| 176 | } |
| 177 | |
| 178 | $("#check-email-forward_email").on("click", function () { |
| 179 | if ($(this).is(":checked")) { |
| 180 | forward_email_to.show(); |
| 181 | forward_email_cc.show(); |
| 182 | forward_email_bcc.show(); |
| 183 | } else { |
| 184 | forward_email_to.hide(); |
| 185 | forward_email_cc.hide(); |
| 186 | forward_email_bcc.hide(); |
| 187 | } |
| 188 | }); |
| 189 | |
| 190 | var retention_amount = $(".check_email_retention_amount"); |
| 191 | if (!$("#check-email-is_retention_amount_enable").is(":checked")) { |
| 192 | retention_amount.hide(); |
| 193 | } |
| 194 | |
| 195 | |
| 196 | $("#check-email-is_retention_amount_enable").on("click", function () { |
| 197 | if ($(this).is(":checked")) { |
| 198 | retention_amount.show(); |
| 199 | } else { |
| 200 | retention_amount.hide(); |
| 201 | } |
| 202 | }); |
| 203 | |
| 204 | |
| 205 | var period = $(".check_email_log_retention_period"); |
| 206 | var days = $(".check_email_log_retention_period_in_days"); |
| 207 | if (!$("#check-email-is_retention_period_enable").is(":checked")) { |
| 208 | period.hide(); |
| 209 | days.hide(); |
| 210 | } |
| 211 | |
| 212 | $("#check-email-is_retention_period_enable").on("click", function () { |
| 213 | if ($(this).is(":checked")) { |
| 214 | period.show(); |
| 215 | $('#check-email-log_retention_period').trigger('change'); |
| 216 | } else { |
| 217 | period.hide(); |
| 218 | days.hide(); |
| 219 | } |
| 220 | }); |
| 221 | |
| 222 | |
| 223 | if ($("#check-email-log_retention_period").val() != 'custom_in_days') { |
| 224 | days.hide(); |
| 225 | } |
| 226 | $("#check-email-log_retention_period").on("change", function () { |
| 227 | if ($(this).val() == 'custom_in_days') { |
| 228 | days.show(); |
| 229 | } else { |
| 230 | days.hide(); |
| 231 | } |
| 232 | }); |
| 233 | |
| 234 | $(".check_main_js_display_checkbox").on("click", function () { |
| 235 | if ($(this).is(":checked")) { |
| 236 | $(this).next('.check_mail_js_hidden_display').val(1); |
| 237 | } else { |
| 238 | $(this).next('.check_mail_js_hidden_display').val(0); |
| 239 | } |
| 240 | }); |
| 241 | $(".check_main_js_error_tracking").on("click", function () { |
| 242 | if ($(this).is(":checked")) { |
| 243 | $(this).next('.check_main_js_error_tracking_hidden').val(1); |
| 244 | } else { |
| 245 | $(this).next('.check_main_js_error_tracking_hidden').val(0); |
| 246 | } |
| 247 | }); |
| 248 | $(".check-email-enable-widget_checkbox").on("click", function () { |
| 249 | if ($(this).is(":checked")) { |
| 250 | $(this).next('.check-email-enable-widget_display').val(1); |
| 251 | } else { |
| 252 | $(this).next('.check-email-enable-widget_display').val(0); |
| 253 | } |
| 254 | }); |
| 255 | |
| 256 | |
| 257 | }); |
| 258 | |
| 259 | |
| 260 | $(document).on('click', '.check_email_mailer_type', function(e){ |
| 261 | $(".ck_radio_selected").removeClass('ck_radio_selected'); |
| 262 | if($(this).val() == 'outlook'){ |
| 263 | $('#check-email-outllook').show(); |
| 264 | $('#check-email-smtp-form').hide(); |
| 265 | $(this).parents('.ce_radio-label').addClass('ck_radio_selected'); |
| 266 | } |
| 267 | if($(this).val() == 'smtp' || $(this).val() == 'gmail'){ |
| 268 | $('#check-email-outllook').hide(); |
| 269 | $('#check-email-smtp-form').show(); |
| 270 | $(this).parents('.ce_radio-label').addClass('ck_radio_selected'); |
| 271 | } |
| 272 | }); |
| 273 | $(document).on('click', '#check-email-email-encode-options-is_enable', function(e){ |
| 274 | if ($(this).is(":checked")) { |
| 275 | $('.check-email-etr').show(); |
| 276 | } else { |
| 277 | $('.check-email-etr').hide(); |
| 278 | } |
| 279 | }); |
| 280 | |
| 281 | $(document).on('click', '#check_email_remove_outlook', function(e){ |
| 282 | t = jQuery(this); |
| 283 | var ajaxurl = checkemail_data.ajax_url; |
| 284 | var nonce = checkemail_data.ck_mail_security_nonce; |
| 285 | jQuery.ajax({ |
| 286 | url:ajaxurl, |
| 287 | method:'post', |
| 288 | dataType: "json", |
| 289 | data:{action:"check_email_remove_outlook",'ck_mail_security_nonce':nonce}, |
| 290 | beforeSend: function(response){ |
| 291 | }, |
| 292 | success:function(response){ |
| 293 | if (response.status == 200) { |
| 294 | location.reload(); |
| 295 | } |
| 296 | }, |
| 297 | complete:function(response){ |
| 298 | } |
| 299 | }); |
| 300 | }); |
| 301 | |
| 302 | $("#check_mail_request_uri").on("click", function () { |
| 303 | check_email_copy_code(); |
| 304 | }) |
| 305 | |
| 306 | function check_email_copy_code() { |
| 307 | var copyText = document.getElementById("check_mail_request_uri"); |
| 308 | |
| 309 | // Select the text field |
| 310 | copyText.select(); |
| 311 | |
| 312 | // Copy the text inside the text field |
| 313 | navigator.clipboard.writeText(copyText.value); |
| 314 | |
| 315 | // Alert the copied text |
| 316 | $("#check_mail_copy_text").html("Copied!"); |
| 317 | } |
| 318 | |
| 319 | function chec_email_manage_display_state() { |
| 320 | if($('#check-email-enable-smtp').is(':checked')){ |
| 321 | var check_email_mailer_type = $(".check_email_mailer_type:checked").val(); |
| 322 | if(check_email_mailer_type == 'outlook'){ |
| 323 | $('#check-email-outllook').show(); |
| 324 | $('#check-email-smtp-form').hide(); |
| 325 | } |
| 326 | if(check_email_mailer_type == 'smtp' || check_email_mailer_type == 'gmail'){ |
| 327 | $('#check-email-outllook').hide(); |
| 328 | $('#check-email-smtp-form').show(); |
| 329 | } |
| 330 | } |
| 331 | } |
| 332 | $(document).on('click', '#check-email-email-notify-options-is_enable', function(e){ |
| 333 | if($(this).is(':checked')){ |
| 334 | $('#ck-notify-table-id').show(); |
| 335 | }else{ |
| 336 | $('#ck-notify-table-id').hide(); |
| 337 | } |
| 338 | }); |
| 339 | $(document).on('click', '#check-email-notify-by-sms-enable', function(e){ |
| 340 | if($(this).is(':checked')){ |
| 341 | $('.check-email-twilio').show(); |
| 342 | }else{ |
| 343 | $('.check-email-twilio').hide(); |
| 344 | } |
| 345 | }); |
| 346 | $(document).on('click', '.checkmail_trigger', function(e){ |
| 347 | parent_tr = $(this).parents('tr') |
| 348 | if($(this).is(':checked')){ |
| 349 | parent_tr.find('.checkmail_trigger_counts').show(); |
| 350 | $(this).next('label').hide(); |
| 351 | }else{ |
| 352 | parent_tr.find('.checkmail_trigger_counts').hide(); |
| 353 | $(this).next('label').show(); |
| 354 | } |
| 355 | }); |
| 356 | |
| 357 | $("#ck_email_analyze").on("click", function(e){ |
| 358 | e.preventDefault(); |
| 359 | jQuery('.cm_js_error').html(''); |
| 360 | jQuery('.cm_js_success').html(''); |
| 361 | var t = $(this); |
| 362 | const loader = document.getElementById('ck_loader'); |
| 363 | var ajaxurl = checkemail_data.ajax_url; |
| 364 | var ck_mail_security_nonce = checkemail_data.ck_mail_security_nonce; |
| 365 | data = { action:"check_email_analyze", ck_mail_security_nonce:ck_mail_security_nonce}; |
| 366 | jQuery.ajax({ |
| 367 | url:ajaxurl, |
| 368 | method:'post', |
| 369 | dataType: "json", |
| 370 | data:data, |
| 371 | beforeSend: function(response){ |
| 372 | loader.style.display = 'block'; |
| 373 | t.hide(); |
| 374 | }, |
| 375 | success:function(response){ |
| 376 | if (response.is_error == 0) { |
| 377 | email_result = response.previous_email_result; |
| 378 | blocklist = response.blocklist; |
| 379 | previous_spam_score = response.previous_spam_score; |
| 380 | links = response.data.links; |
| 381 | authenticated = response.data.authenticated; |
| 382 | report = response.data.spamcheck_result.report; |
| 383 | scores = response.data.spamcheck_result.rules; |
| 384 | data = response.data; |
| 385 | var totalScore = 0; |
| 386 | var final_total = 0; |
| 387 | |
| 388 | wrong_icon_svg = `<svg viewBox="0 0 32 32" height="50px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>cross-circle</title> <desc>Created with Sketch Beta.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-570.000000, -1089.000000)" fill="#fa0000"> <path d="M591.657,1109.24 C592.048,1109.63 592.048,1110.27 591.657,1110.66 C591.267,1111.05 590.633,1111.05 590.242,1110.66 L586.006,1106.42 L581.74,1110.69 C581.346,1111.08 580.708,1111.08 580.314,1110.69 C579.921,1110.29 579.921,1109.65 580.314,1109.26 L584.58,1104.99 L580.344,1100.76 C579.953,1100.37 579.953,1099.73 580.344,1099.34 C580.733,1098.95 581.367,1098.95 581.758,1099.34 L585.994,1103.58 L590.292,1099.28 C590.686,1098.89 591.323,1098.89 591.717,1099.28 C592.11,1099.68 592.11,1100.31 591.717,1100.71 L587.42,1105.01 L591.657,1109.24 L591.657,1109.24 Z M586,1089 C577.163,1089 570,1096.16 570,1105 C570,1113.84 577.163,1121 586,1121 C594.837,1121 602,1113.84 602,1105 C602,1096.16 594.837,1089 586,1089 L586,1089 Z" id="cross-circle" sketch:type="MSShapeGroup"> </path> </g> </g> </g></svg>`; |
| 389 | |
| 390 | yes_icon_svg = `<svg viewBox="0 0 32 32" height="50px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>checkmark-circle</title> <desc>Created with Sketch Beta.</desc> <defs> </defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <g id="Icon-Set-Filled" sketch:type="MSLayerGroup" transform="translate(-102.000000, -1141.000000)" fill="#038608"> <path d="M124.393,1151.43 C124.393,1151.43 117.335,1163.73 117.213,1163.84 C116.81,1164.22 116.177,1164.2 115.8,1163.8 L111.228,1159.58 C110.85,1159.18 110.871,1158.54 111.274,1158.17 C111.677,1157.79 112.31,1157.81 112.688,1158.21 L116.266,1161.51 L122.661,1150.43 C122.937,1149.96 123.548,1149.79 124.027,1150.07 C124.505,1150.34 124.669,1150.96 124.393,1151.43 L124.393,1151.43 Z M118,1141 C109.164,1141 102,1148.16 102,1157 C102,1165.84 109.164,1173 118,1173 C126.836,1173 134,1165.84 134,1157 C134,1148.16 126.836,1141 118,1141 L118,1141 Z" id="checkmark-circle" sketch:type="MSShapeGroup"> </path> </g> </g> </g></svg>`; |
| 391 | |
| 392 | warning_icon_svg = `<svg viewBox="0 0 16 16" height="50px" xmlns="http://www.w3.org/2000/svg" fill="none"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="#f9bc39" fill-rule="evenodd" d="M0 8a8 8 0 1116 0A8 8 0 010 8zm8-4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 6a1 1 0 100 2h.007a1 1 0 100-2H8z" clip-rule="evenodd"></path></g></svg>`; |
| 393 | |
| 394 | // Iterate over the array and sum the scores |
| 395 | $.each(scores, function(index, item) { |
| 396 | totalScore += parseFloat(item.score); // Convert score to a float and add it to the total |
| 397 | }); |
| 398 | $("#ck_top_subject").html('Subject : '+data.html_tab.subject); |
| 399 | $("#ck_email_date").html('Received : '+ck_timeAgo(data.html_tab.date)); |
| 400 | |
| 401 | html_tab = `<div class="ck-accordion"> |
| 402 | <div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"> |
| 403 | <div class="ck_icon_with_text"> |
| 404 | <span class="">`+yes_icon_svg+`</span> |
| 405 | <span class="ck_header_span">Click here to view your message</span> |
| 406 | </div> |
| 407 | </div> |
| 408 | <div class="ck-accordion-content"> |
| 409 | <p><strong>From : </strong>`+data.html_tab.from+`</p> |
| 410 | <p><strong>Email : </strong>`+data.html_tab.email+`</p> |
| 411 | <p><strong>Subject : </strong>`+data.html_tab.subject+`</p> |
| 412 | <p><strong>Date : </strong>`+data.html_tab.date+`</p> |
| 413 | |
| 414 | <!-- Child Accordion --> |
| 415 | <div class="ck-child-accordion"> |
| 416 | <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)"> |
| 417 | HTML version |
| 418 | </div> |
| 419 | <div class="ck-child-accordion-content"> |
| 420 | <p>`+data.html_tab.body+`</p> |
| 421 | </div> |
| 422 | </div> |
| 423 | <div class="ck-child-accordion"> |
| 424 | <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)"> |
| 425 | Text version |
| 426 | </div> |
| 427 | <div class="ck-child-accordion-content"> |
| 428 | <p><pre>`+data.html_tab.body+`</pre></p> |
| 429 | </div> |
| 430 | </div> |
| 431 | <div class="ck-child-accordion"> |
| 432 | <div class="ck-child-accordion-header" onclick="ck_toggleAccordion(this)"> |
| 433 | Source |
| 434 | </div> |
| 435 | <div class="ck-child-accordion-content"> |
| 436 | <p><pre>`+data.html_tab.source+`</pre></p> |
| 437 | </div> |
| 438 | </div> |
| 439 | </div> |
| 440 | </div>`; |
| 441 | if (totalScore.toFixed(1) > 0) { |
| 442 | spam_icon = yes_icon_svg; |
| 443 | spam_text = "SpamAssassin likes you"; |
| 444 | spam_score = 2.5; |
| 445 | } else if (totalScore.toFixed(1) < 0 && totalScore.toFixed(1) > -5) { |
| 446 | spam_icon = warning_icon_svg; |
| 447 | spam_text = "SpamAssassin warned you to <strong>improve</strong> your spam score"; |
| 448 | spam_score = 1.5; |
| 449 | } else{ |
| 450 | spam_icon = wrong_icon_svg; |
| 451 | spam_text = "SpamAssassin <strong>don't</strong> likes you"; |
| 452 | spam_score = 0; |
| 453 | } |
| 454 | html_tab+=`<div class="ck-accordion"><div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"><div class="ck_icon_with_text"><span class="">`+spam_icon+`</span> |
| 455 | <span class="ck_header_span">`+spam_text+`</span><span class="ck_score_span">Score : `+totalScore.toFixed(1)+`</span></div></div><div class="ck-accordion-content"> |
| 456 | <p><i>The famous spam filter SpamAssassin. </i> <strong>Score:`+totalScore.toFixed(1)+`</strong></p><p><i>A score below -5 is considered spam.</i></p><hr/><p><pre>`+report+`</pre></p></div></div>`; |
| 457 | email_result_html =""; |
| 458 | if (email_result.email_valid) { |
| 459 | email_result_html +='<div class="ck-card">\ |
| 460 | <h4>Format <span class="ck-status">Valid</span></h4>\ |
| 461 | <p>This email address has the correct format and is not gibberish.</p>\ |
| 462 | </div>'; |
| 463 | }else{ |
| 464 | email_result_html +='<div class="ck-card">\ |
| 465 | <h4>Format <span class="ck-status" style="background-color:pink;color:red;">Invalid</span></h4>\ |
| 466 | <p>This email address is not correct.</p>\ |
| 467 | </div>'; |
| 468 | } |
| 469 | if (email_result.email_valid) { |
| 470 | email_result_html +='<div class="ck-card">\ |
| 471 | <h4>Type <span class="ck-status" style="background-color: #cce5ff; color: #004085;">Professional</span></h4>\ |
| 472 | <p>The domain name is not used for webmails or for creating temporary email addresses.</p>\ |
| 473 | </div>'; |
| 474 | } |
| 475 | if (email_result.dns_valid) { |
| 476 | email_result_html +='<div class="ck-card">\ |
| 477 | <h4>Server status <span class="ck-status">Valid</span></h4>\ |
| 478 | <p>MX records are present for the domain and we can connect to the SMTP server these MX records point to.</p>\ |
| 479 | </div>'; |
| 480 | }else{ |
| 481 | email_result_html +='<div class="ck-card">\ |
| 482 | <h4>Server status <span class="ck-status" style="background-color:pink;color:red">Invalid</span></h4>\ |
| 483 | <p>MX records are not present for the domain, or we cannot connect to the SMTP server</p>\ |
| 484 | </div>'; |
| 485 | } |
| 486 | if (email_result.dns_valid) { |
| 487 | email_result_html +='<div class="ck-card">\ |
| 488 | <h4>Email status<span class="ck-status">Valid</span></h4>\ |
| 489 | <p>This email address exists and can receive emails.</p>\ |
| 490 | </div>'; |
| 491 | }else{ |
| 492 | email_result_html +='<div class="ck-card">\ |
| 493 | <h4>Email status<span class="ck-status" style="background-color:pink;color:red">Invalid</span></h4>\ |
| 494 | <p>This email address can not receive emails.</p>\ |
| 495 | </div>'; |
| 496 | } |
| 497 | html_tab+=`<div class="ck-accordion"><div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"><div class="ck_icon_with_text"><span class="">`+yes_icon_svg+`</span> |
| 498 | <span class="ck_header_span">Email validation result</span></div></div><div class="ck-accordion-content">`+email_result_html+`</div></div>`; |
| 499 | |
| 500 | html_content = ""; |
| 501 | vuln = ""; |
| 502 | vuln_count = 0; |
| 503 | $.each( authenticated, function( key, value ) { |
| 504 | style =''; |
| 505 | if (!value.status) { |
| 506 | vuln_count +=1; |
| 507 | style ='background-color:pink;color:red;'; |
| 508 | vuln +='<span class="ck-status" style="'+style+'">'+key+'</span>'; |
| 509 | } |
| 510 | html_content +='<div class="ck-card">\ |
| 511 | <h4><span class="ck-status" style="'+style+'">'+key+'</span></h4>\ |
| 512 | <p style="color:blue; overflow-wrap:break-word;">'+value.message+'</p>\ |
| 513 | </div>'; |
| 514 | }); |
| 515 | if (vuln_count == 0) { |
| 516 | auth_icon = yes_icon_svg; |
| 517 | auth_text = "You're properly authenticated"; |
| 518 | auth_score = 2.5; |
| 519 | } else if (vuln_count > 0 && vuln_count < 3) { |
| 520 | auth_icon = warning_icon_svg; |
| 521 | auth_text = "You're <strong>not</strong> properly authenticated need some improvement"; |
| 522 | auth_score = 1.5; |
| 523 | } else if (vuln_count >= 3) { |
| 524 | auth_icon = wrong_icon_svg; |
| 525 | auth_text = "You're <strong>not</strong> properly authenticated"; |
| 526 | auth_score = 0; |
| 527 | } |
| 528 | if (vuln) { |
| 529 | html_content +='<div class="ck-card">\ |
| 530 | <h4>Summary'+vuln+'</h4>\ |
| 531 | <p style="color:red; overflow-wrap: break-word;"><strong>Vulnerabilities detected :</strong>Recommendation: Address the identified vulnerabilities to improve DNS security.</p>\ |
| 532 | </div>'; |
| 533 | } |
| 534 | |
| 535 | html_tab+=`<div class="ck-accordion"><div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"><div class="ck_icon_with_text"><span class="">`+auth_icon+`</span><span class="ck_header_span">`+auth_text+`</span></div></div><div class="ck-accordion-content">`+html_content+`</div></div>`; |
| 536 | blocklist_html = ""; |
| 537 | block_count = 0; |
| 538 | $.each( blocklist, function( kue, value ) { |
| 539 | if (value.status) { |
| 540 | block_count +=1; |
| 541 | blocklist_html+=` <div class="ck-card" style="display:inline-flex; margin:5px; padding:5px; width:30%;"><h4><span class="ck-status" style="color:red; background-color:pink;">Listed : `+value.ip+`</span></h4></div>`; |
| 542 | }else{ |
| 543 | blocklist_html+=` <div class="ck-card" style="margin:5px; padding:5px;display:inline-flex; width:30%;"><h4><span class="ck-status" style="color:green;">Not Listed : `+value.ip+`</span></h4></div>`; |
| 544 | } |
| 545 | }) |
| 546 | if (block_count == 0) { |
| 547 | block_icon = yes_icon_svg; |
| 548 | block_text = "You're not <strong>blocklisted</strong>"; |
| 549 | block_score = 2.5; |
| 550 | } else if (block_count > 0 && block_count <= 12) { |
| 551 | block_icon = warning_icon_svg; |
| 552 | block_text = "You're <strong>blocklisted</strong> need some improvement"; |
| 553 | block_score = 1.5; |
| 554 | } else if (block_count > 12) { |
| 555 | block_icon = wrong_icon_svg; |
| 556 | block_text = "You're <strong>blocklisted</strong>"; |
| 557 | block_score = 0; |
| 558 | } |
| 559 | html_tab+=`<div class="ck-accordion"><div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"><div class="ck_icon_with_text"><span class="">`+block_icon+`</span> |
| 560 | <span class="ck_header_span">`+block_text+`</span></div></div><div class="ck-accordion-content"><i><strong>Matches your server IP address (`+response.ip_address+`) against 24 of the most common IPv4 blocklists.</strong></i><hr/>`+blocklist_html+`</div></div>`; |
| 561 | links_html = ""; |
| 562 | link_count = 0; |
| 563 | $.each( links, function( link, value ) { |
| 564 | if (value.status > 200) { |
| 565 | link_count +=1; |
| 566 | } |
| 567 | links_html+=` <p><strong>Status:`+value.status+`</strong> `+link+`</p>`; |
| 568 | }) |
| 569 | if (link_count == 0) { |
| 570 | link_icon = yes_icon_svg; |
| 571 | link_text = "No broken links"; |
| 572 | link_score = 2.5; |
| 573 | } else { |
| 574 | link_icon = warning_icon_svg; |
| 575 | link_text = "<strong>Found</strong> broken links"; |
| 576 | link_score = 1.5; |
| 577 | } |
| 578 | html_tab+=`<div class="ck-accordion"><div class="ck-accordion-header" onclick="ck_toggleAccordion(this)"><div class="ck_icon_with_text"><span class="">`+link_icon+`</span> |
| 579 | <span class="ck_header_span">`+link_text+`</span></div></div><div class="ck-accordion-content"><i><strong>Checks if your email contains broken links.</strong></i><hr/>`+links_html+`</div></div>`; |
| 580 | |
| 581 | $("#ck_email_analyze_result").html(html_tab); |
| 582 | $(".ck_score_cls").show(); |
| 583 | $(".ck_subject_bar").show(); |
| 584 | final_total = (link_score + auth_score+spam_score+block_score); |
| 585 | final_score_text = 'Wow! Perfect'; |
| 586 | if (final_total == 10) { |
| 587 | final_score_text = "Hey you need to improve"; |
| 588 | final_score_color = "#038608"; |
| 589 | }else if (final_total == 9) { |
| 590 | final_score_text = "Good"; |
| 591 | final_score_color = "#038608"; |
| 592 | }else if (final_total < 9 && final_total > 5) { |
| 593 | final_score_text = "Need Improvement"; |
| 594 | final_score_color = "#f9bc39"; |
| 595 | } else if (final_total <= 5) { |
| 596 | final_score_text = "Need Fixing Urgently"; |
| 597 | final_score_color = "#fa0000"; |
| 598 | } |
| 599 | $("#ck_email_analyze_result").html(html_tab); |
| 600 | $(".ck_score").css("background-color", final_score_color); |
| 601 | $("#ck_score_text").text(final_score_text); |
| 602 | $(".ck_score").html(final_total+' / 10'); |
| 603 | }else{ |
| 604 | html_content = ''; |
| 605 | if ( response.error ) { |
| 606 | html_content ='<p style="color:red;">'+response.error+'</p>'; |
| 607 | }else if ( response.response ) { |
| 608 | html_content ='<p style="color:red;">'+response.response+'</p>'; |
| 609 | } |
| 610 | $("#ck_email_analyze_result").html(html_content); |
| 611 | t.show(); |
| 612 | } |
| 613 | loader.style.display = 'none'; |
| 614 | }, |
| 615 | complete:function(response){ |
| 616 | loader.style.display = 'none'; |
| 617 | } |
| 618 | |
| 619 | }); |
| 620 | }); |
| 621 | |
| 622 | function ck_timeAgo(dateString) { |
| 623 | let date = new Date(dateString); // Convert to Date object |
| 624 | let now = new Date(); // Current date |
| 625 | |
| 626 | let diffInSeconds = Math.floor((now - date) / 1000); // Difference in seconds |
| 627 | let interval; |
| 628 | |
| 629 | if (diffInSeconds < 0) return "In the future"; // Handle future dates |
| 630 | |
| 631 | // Define intervals |
| 632 | let intervals = [ |
| 633 | { label: "year", seconds: 31536000 }, |
| 634 | { label: "month", seconds: 2592000 }, |
| 635 | { label: "day", seconds: 86400 }, |
| 636 | { label: "hour", seconds: 3600 }, |
| 637 | { label: "minute", seconds: 60 }, |
| 638 | { label: "second", seconds: 1 } |
| 639 | ]; |
| 640 | |
| 641 | // Find the correct interval |
| 642 | for (let i = 0; i < intervals.length; i++) { |
| 643 | interval = Math.floor(diffInSeconds / intervals[i].seconds); |
| 644 | if (interval > 0) { |
| 645 | return `${interval} ${intervals[i].label}${interval !== 1 ? "s" : ""} ago`; |
| 646 | } |
| 647 | } |
| 648 | return "Just now"; // Default fallback |
| 649 | } |
| 650 | |
| 651 | })(jQuery); |
| 652 | |
| 653 |