function es_sync_registereduser($user_id) { $es_c_emailsubscribers = get_option('es_c_emailsubscribers', 'norecord'); if ($es_c_emailsubscribers == 'norecord' || $es_c_emailsubscribers == "") { // No action is required } else { if ($es_c_emailsubscribers['es_registered'] == "YES" && $user_id != "") { $es_registered = $es_c_emailsubscribers['es_registered']; $es_registered_group = $es_c_emailsubscribers['es_registered_group']; $user_info = get_userdata($user_id); $user_firstname = $user_info->user_firstname; if ($user_firstname == "") { $user_firstname = $user_info->user_login; } $user_mail = $user_info->user_email; $form['es_email_name'] = $user_firstname; $form['es_email_mail'] = $user_mail; $form['es_email_group'] = $es_c_emailsubscribers['es_registered_group']; $form['es_email_status'] = "Confirmed"; $action = es_cls_dbquery::es_view_subscriber_ins($form, "insert"); if ($action == "sus") { //Inserted successfully. Below 3 line of code will send WELCOME email to subscribers. $subscribers = array(); $subscribers = es_cls_dbquery::es_view_subscriber_one($user_mail); es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0); } } } }
$es_errors[] = __('Please select your mail subject.', ES_TDOMAIN); $es_error_found = TRUE; } $form['es_email_group'] = isset($_POST['es_email_group']) ? $_POST['es_email_group'] : ''; $recipients = isset($_POST['eemail_checked']) ? $_POST['eemail_checked'] : ''; if ($recipients == '') { $es_errors[] = __('No email address selected.', ES_TDOMAIN); $es_error_found = TRUE; } $form['es_sent_type'] = isset($_POST['es_sent_type']) ? $_POST['es_sent_type'] : ''; if ($form['es_sent_type'] == '') { $es_errors[] = __('Please select your mail type.', ES_TDOMAIN); $es_error_found = TRUE; } if ($es_error_found == FALSE) { es_cls_sendmail::es_prepare_newsletter_manual($es_templ_heading, $recipients, $form['es_sent_type']); $es_success_msg = TRUE; $es_success = __('Mail sent successfully', ES_TDOMAIN); if ($es_success_msg == TRUE) { ?> <div class="updated fade"> <p> <strong><?php echo $es_success; ?> <a href="<?php echo ES_ADMINURL; ?> ?page=es-sentmail"><?php _e('Click here for details', ES_TDOMAIN); ?>
$form['es_email_group'] = $es_group; $data = es_cls_settings::es_setting_select(1); if ($data['es_c_optinoption'] == "Double Opt In") { $form['es_email_status'] = "Unconfirmed"; } else { $form['es_email_status'] = "Single Opt In"; } $action = es_cls_dbquery::es_view_subscriber_widget($form); if ($action == "sus") { $subscribers = array(); $subscribers = es_cls_dbquery::es_view_subscriber_one($es_email); if ($data['es_c_optinoption'] == "Double Opt In") { es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0); echo "subscribed-pending-doubleoptin"; } else { if ($data['es_c_usermailoption'] == "YES") { es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0); } echo "subscribed-successfully"; } } elseif ($action == "ext") { echo "already-exist"; } } else { echo "unexpected-error"; } } } } } die;
</strong></p> </div> <?php } else { if (!empty($chk_delete)) { $count = count($chk_delete); $idlist = ""; for ($i = 0; $i < $count; $i++) { $del_id = $chk_delete[$i]; if ($i < 1) { $idlist = $del_id; } else { $idlist = $idlist . ", " . $del_id; } } es_cls_sendmail::es_prepare_optin("group", 0, $idlist); es_cls_dbquery::es_view_subscriber_upd_status("Unconfirmed", $idlist); $es_success_msg = TRUE; $es_success = __('Confirmation email(s) resent successfully.', ES_TDOMAIN); } else { ?> <div class="error fade"> <p><strong><?php _e('Oops, No record was selected.', ES_TDOMAIN); ?> </strong></p> </div> <?php } } } elseif (isset($_POST['frm_es_bulkaction']) && $_POST['frm_es_bulkaction'] == 'groupupdate') {
public static function es_prepare_newsletter_manual($template, $recipients) { $subscribers = array(); $subscribers = es_cls_dbquery::es_view_subscriber_manual($recipients); es_cls_sendmail::es_sendmail("newsletter", $template, $subscribers, "manual", 0); }
if (!is_numeric($form['db'])) { $noerror = false; } if (!filter_var($form['email'], FILTER_VALIDATE_EMAIL)) { $noerror = false; } } // Load default message $data = array(); $data = es_cls_settings::es_setting_select(1); if ($noerror) { $resultcheck = es_cls_dbquery::es_view_subscriber_jobstatus("Confirmed", $form['db'], $form['guid'], $form['email']); if (!$resultcheck) { $result = es_cls_dbquery::es_view_subscriber_job("Confirmed", $form['db'], $form['guid'], $form['email']); if ($result) { es_cls_sendmail::es_prepare_welcome($form['db']); $message = esc_html(stripslashes($data['es_c_subhtml'])); $message = str_replace("\r\n", "<br />", $message); } else { $message = esc_html(stripslashes($data['es_c_message2'])); } if ($message == "") { $message = __('Oops.. We are getting some technical error. Please try again or contact admin.', ES_TDOMAIN); } } else { $message = __('This email address has already been confirmed.', ES_TDOMAIN); } echo $message; } else { $message = esc_html(stripslashes($data['es_c_message2'])); $message = str_replace("\r\n", "<br />", $message);
public static function es_af_preparation($es_af_name = "", $es_af_email = "", $es_af_group = array()) { $sts = ""; $data = es_cls_settings::es_setting_select(1); $form = array('es_email_name' => '', 'es_email_status' => '', 'es_email_group' => '', 'es_email_mail' => ''); $email_saved_single_opt_in = 0; $email_saved_double_opt_in = 0; $email_already_exists = 0; $es_af_group_count = count($es_af_group); if ($es_af_group_count > 0) { for ($i = 0; $i < $es_af_group_count; $i++) { $form['es_email_name'] = $es_af_name; $form['es_email_mail'] = $es_af_email; $form['es_email_group'] = $es_af_group[$i]; if ($data['es_c_optinoption'] == "Double Opt In") { $form['es_email_status'] = "Unconfirmed"; } else { $form['es_email_status'] = "Single Opt In"; } $action = es_cls_dbquery::es_view_subscriber_widget($form); if ($action == "sus") { $subscribers = array(); $subscribers = es_cls_dbquery::es_view_subscriber_one($form['es_email_mail']); if ($data['es_c_optinoption'] == "Double Opt In") { if ($email_saved_double_opt_in == 0) { es_cls_sendmail::es_sendmail("optin", $template = 0, $subscribers, "optin", 0); } $email_saved_double_opt_in = $email_saved_double_opt_in + 1; } else { if ($data['es_c_usermailoption'] == "YES") { if ($email_saved_single_opt_in == 0) { es_cls_sendmail::es_sendmail("welcome", $template = 0, $subscribers, "welcome", 0); } } $email_saved_single_opt_in = $email_saved_single_opt_in + 1; } } elseif ($action == "ext") { $email_already_exists = $email_already_exists + 1; } } } if ($email_saved_double_opt_in > 0) { $sts = "double_opt_in_saved"; } elseif ($email_saved_single_opt_in > 0) { $sts = "single_opt_in_saved"; } elseif ($email_already_exists > 0) { $sts = "emails_already_exists"; } else { $sts = "no_email_saved"; } return $sts; }
if ($es_c_cronguid != "") { $security1 = strlen($es_c_cronguid); $es_c_cronguid_noslash = str_replace("-", "", $es_c_cronguid); $security2 = strlen($es_c_cronguid_noslash); if ($security1 == 34 && $security2 == 30) { if (!preg_match('/[^a-z]/', $es_c_cronguid_noslash)) { $es_c_cronurl = get_option('es_c_cronurl'); $es_c_croncount = get_option('es_cron_mailcount'); parse_str($es_c_cronurl, $output); if ($es_c_cronguid == $output['guid']) { if (!is_numeric($es_c_croncount)) { $es_c_croncount = 50; } $cronmailqueue = es_cls_sentmail::es_sentmail_cronmail_inqueue(); if (count($cronmailqueue) > 0) { $crondeliveryqueue = es_cls_delivery::es_delivery_cronmail_inqueue($es_c_croncount, $cronmailqueue[0]['es_sent_guid']); if (count($crondeliveryqueue) > 0) { es_cls_sendmail::es_prepare_send_cronmail($cronmailqueue, $crondeliveryqueue); } $cronmailqueuecnt = es_cls_delivery::es_delivery_cronmail_count($cronmailqueue[0]['es_sent_guid']); if ($cronmailqueuecnt == 0) { es_cls_sentmail::es_sentmail_cronmail_ups($cronmailqueue[0]['es_sent_guid']); } } } } } } } } die;
$sendmailsubmit = isset($_POST['sendmailsubmit']) ? $_POST['sendmailsubmit'] : 'no'; if ($sendmailsubmit == 'yes') { check_admin_referer('es_form_submit'); $form['es_templ_heading'] = isset($_POST['es_templ_heading']) ? $_POST['es_templ_heading'] : ''; if ($form['es_templ_heading'] == '') { $es_errors[] = __('Please select your mail subject.', ES_TDOMAIN); $es_error_found = TRUE; } $form['es_email_group'] = isset($_POST['es_email_group']) ? $_POST['es_email_group'] : ''; $recipients = isset($_POST['eemail_checked']) ? $_POST['eemail_checked'] : ''; if ($recipients == '') { $es_errors[] = __('No email address selected.', ES_TDOMAIN); $es_error_found = TRUE; } if ($es_error_found == FALSE) { es_cls_sendmail::es_prepare_newsletter_manual($es_templ_heading, $recipients); $es_success_msg = TRUE; $es_success = __('Mail sent successfully', ES_TDOMAIN); if ($es_success_msg == TRUE) { ?> <div class="updated fade"> <p> <strong><?php echo $es_success; ?> <a href="<?php echo ES_ADMINURL; ?> ?page=es-sentmail"><?php _e('Click here for details', ES_TDOMAIN); ?>