'.($promos ? ' ' : '').'

'.esc_html($title).'

Review GoSMTP

'.gosmtp_show_notices().'
'; $promos = apply_filters('pagelayer_right_bar_promos', true); if($promos){ echo '
'; } // The Gosmtp Settings footer function gosmtp_page_footer($no_twitter = 0){ echo '
The Best WordPress Site Builder :
  • Drag & Drop Editor
  • Widgets
  • In-line Editing
  • Styling Options
  • Animations
  • Easily customizable
  • Real Time Design
  • And many more ...
Visit Pagelayer
Protect your WordPress website from unauthorized access and malware :
  • BruteForce Protection
  • reCaptcha
  • Two Factor Authentication
  • Black/Whitelist IP
  • Detailed Logs
  • Extended Lockouts
  • 2FA via Email
  • And many more ...
Visit Loginizer
'; } echo '

'; if(empty($no_twitter)){ echo '
Let your followers know that you use GOSMTP to Sent mail on your website :
   

GOSMTP v'.GOSMTP_VERSION.' You can report any bugs here. '; } } // GoSMTP Setting page function gosmtp_settings_page(){ $action = gosmtp_optget('auth'); $state = gosmtp_optget('state'); $code = gosmtp_optget('code'); // For authentication of Gmail, Zoho and Outlook if(!empty($action) && !empty($state) && !empty($code)){ $resp = explode('-',$state); $uri = admin_url().'admin.php?page=gosmtp&auth_code='.$code.'&auth='.$action; if(!empty($resp[1])){ $uri.='&type=edit&&conn_id='.$resp[1].'#gosmtp-connections-settings'; } echo ''; return; } if(defined('GOSMTP_PREMIUM')){ include_once GOSMTP_PRO_DIR .'/main/settings.php'; } $all_mailers = gosmtp_load_mailer_list(); $options = get_option('gosmtp_options', array()); //do_action('gosmtp_before_settings_page_load'); // Save SMTP details if (isset($_REQUEST['save'])) { // Check nonce check_admin_referer('gosmtp-options'); $force_from_email = !empty($_REQUEST['force_from_email']) ? 1 : ''; $force_from_name = !empty($_REQUEST['force_from_name']) ? 1 : ''; $return_path = !empty($_REQUEST['return_path']) ? 1 : ''; $save_mailer = gosmtp_optreq('mailer'); $option['mail_type'] = $save_mailer; if(isset($_REQUEST['nickname'])){ $option['nickname'] = gosmtp_optreq('nickname'); } if(isset($_REQUEST['backup_mailer'])){ $option['backup_connection'] = gosmtp_optreq('backup_mailer'); } if(!isset($options['mailer'])){ $options['mailer'] = []; } $mailer_id = 0; $redirect = false; // Update fields of mailer if(!empty($save_mailer) && !method_exists($all_mailers[$save_mailer], 'save_option')){ // Set for primary email if(!isset($options['mailer'][0]) || (isset($_REQUEST['conn_id']) && is_numeric($_REQUEST['conn_id']) && $_REQUEST['conn_id'] == 0)){ $options['from_email'] = gosmtp_optreq('from_email'); $options['force_from_email'] = $force_from_email; $options['from_name'] = gosmtp_optreq('from_name'); $options['force_from_name'] = $force_from_name; $options['return_path'] = $return_path; $options['mailer'][0] = $all_mailers[$save_mailer]->save_options($option); }else{ if(!empty($_REQUEST['conn_id'])){ $mailer_id = $_REQUEST['conn_id']; }else{ $redirect = true; $mailer_id = gosmtp_RandomId(); } $option['from_email'] = gosmtp_optreq('from_email'); $option['force_from_email'] = $force_from_email; $option['from_name'] = gosmtp_optreq('from_name'); $option['force_from_name'] = $force_from_name; $option['return_path'] = $return_path; $options['mailer'][$mailer_id] = $all_mailers[$save_mailer]->save_options($option); } } $options = apply_filters( 'gosmtp_save_options', $options ); if(update_option( 'gosmtp_options', $options )){ $msg['success'] = 1; if($redirect){ $uri = admin_url().'admin.php?page=gosmtp&type=edit&conn_id='.$mailer_id.'#gosmtp-connections-settings'; echo ''; } } } if(!empty($_REQUEST['delete_connection'])){ // Check nonce check_admin_referer('gosmtp-options'); $options = get_option('gosmtp_options', array()); $conn_id = gosmtp_optreq('delete_connection'); if(!empty($conn_id)){ $backup_id = isset($options['mailer'][0]['backup_connection']) ? $options['mailer'][0]['backup_connection'] : ''; if($backup_id == $conn_id){ unset($options['mailer'][0]['backup_connection']); } // Remove connection unset($options['mailer'][$conn_id]); if(update_option( 'gosmtp_options', $options )){ $msg['success'] = 1; } } } if(!empty($_REQUEST['make_backup_connection'])){ // Check nonce check_admin_referer('gosmtp-options'); $options = get_option('gosmtp_options', array()); $conn_id = gosmtp_optreq('make_backup_connection'); $options['mailer'][0]['backup_connection'] = $conn_id; if(update_option( 'gosmtp_options', $options )){ $msg['success'] = 1; } } if(!empty($_REQUEST['clear_backup_connection'])){ // Check nonce check_admin_referer('gosmtp-options'); $options = get_option('gosmtp_options', array()); $conn_id = gosmtp_optreq('clear_backup_connection'); if(isset($options['mailer'][0]) && $options['mailer'][0]['backup_connection'] == $conn_id){ unset($options['mailer'][0]['backup_connection']); } if(update_option( 'gosmtp_options', $options )){ $msg['success'] = 1; } } // SMTP Settings if(isset($_REQUEST['save_settings'])){ // Check nonce check_admin_referer('gosmtp-settings'); $enable_logs = ''; if(!empty($_REQUEST['enable_logs'])){ $enable_logs = 1; if(class_exists('\GOSMTP\Logger')){ $logger = new \GOSMTP\Logger(); $logger->create_table(); } } $save_attach = ''; if(!empty($_REQUEST['log_attachments'])){ $save_attach = 1; } $ret_period = ''; if(!empty($_REQUEST['retention_period'])){ $ret_period = sanitize_text_field($_REQUEST['retention_period']); // Cron already scheduled? if( ! empty($_REQUEST['enable_logs']) && ! wp_next_scheduled( 'gosmtp_log_retention_cron' ) ){ // Set cron schedule wp_schedule_event( time(), 'daily', 'gosmtp_log_retention_cron' ); } } // Is log retention cron scheduled? if(wp_next_scheduled( 'gosmtp_log_retention_cron' ) && (empty($_REQUEST['enable_logs']) || empty($_REQUEST['retention_period']))){ wp_clear_scheduled_hook('gosmtp_log_retention_cron'); } $log_columns = ''; if(!empty($_REQUEST['log_columns'])){ $log_columns = maybe_serialize(($_REQUEST['log_columns'])); } $enable_weekly_reports = ''; if(!empty($_REQUEST['enable_weekly_reports'])){ $enable_weekly_reports = 1; // Cron already scheduled? if(!wp_next_scheduled( 'gosmtp_weekly_email_reports_cron', array(true) ) ){ // Set cron schedule wp_schedule_event( time(), 'daily', 'gosmtp_weekly_email_reports_cron', array(true)); } // Is log weekly email cron scheduled? }elseif( wp_next_scheduled( 'gosmtp_weekly_email_reports_cron' , array(true) ) ){ wp_clear_scheduled_hook('gosmtp_weekly_email_reports_cron', array(true)); } $weekday = ''; $timestamp = ''; if(!empty($_REQUEST['weekday']) && $enable_weekly_reports){ $weekday = $_REQUEST['weekday']; $timestamp = strtotime("next ".$weekday); } $options['logs'] = []; $options['logs']['enable_logs'] = $enable_logs; $options['logs']['log_attachments'] = $save_attach; $options['logs']['retention_period'] = $ret_period; $options['logs']['log_columns'] = $log_columns; $options['weekly_reports'] = []; $options['weekly_reports']['enable_weekly_reports'] = $enable_weekly_reports; $options['weekly_reports']['weekday'] = $weekday; $options['weekly_reports']['timestamp'] = $timestamp; $options = apply_filters( 'gosmtp_save_logs_settings', $options ); if(update_option( 'gosmtp_options', $options )){ $msg['success'] = 1; } } $smtp_options = get_option('gosmtp_options', array()); // Default mailer set mail if(!isset($smtp_options['mailer']) || !is_array($smtp_options['mailer']) || empty($smtp_options['mailer'][0])){ $smtp_options['mailer'] = []; $smtp_options['mailer'][0]['mail_type'] = 'mail'; } echo '
'; gosmtp_page_header(); if(!empty($msg['success'])){ echo '

'.__('SMTP settings have been saved successfully!').'

'; } if(!empty($send_mail['success'])){ echo '

'.__('Mail sent successfully!').'

'; }else if(!empty($send_mail['error'])){ echo '

'.( !empty($send_mail['error_msg']) ? wp_kses_post($send_mail['error_msg']) : __('Unable to send mail, Please check your SMTP details') ).'

'; } $tabs_nav = array( 'smtpsetting' => __('SMTP Settings'), 'test-mail' => __('Test Mail'), 'support' => __('Support') ); $tabs_nav = apply_filters('gosmtp_settings_tabs_nav', $tabs_nav); ?>
$mailer){ if(!method_exists($mailer, 'load_field')){ continue; } echo ''; // Load current options $mailer->loadOptions(); $conn_id = $is_new_connection ? '' : 0; if($is_new_connection){ $conn_id = gosmtp_optget('conn_id'); } // Set connection id $mailer->conn_id = $conn_id; echo gosmtp_create_field($mailer->load_field(), $mailer); } ?>


>


>

>

$mailer){ $is_pro = $disabled = $after_icon = ''; $active_mailer = (isset($settings['mail_type']) && $settings['mail_type'] == $key) ? 'mail_active' : ''; $icon = isset($mailer['icon']) ? $mailer['icon'] : GOSMTP_URL .'/images/'.$key.'.svg'; if(!class_exists($mailer['class'])){ $is_pro = 'pro'; $disabled = 'disabled'; $after_icon='
'; } echo '
'.wp_kses_post($after_icon).'
'; } ?>

'. esc_html($mailer->title) .'

$field){ $attrs = ''; if(!empty($field['attr'])){ $attrs .= esc_attr($field['attr']); } // Added attributes if(!in_array($field['type'], array('button', 'notice'))){ $_type = ($field['type'] == 'copy') ? 'text' : $field['type']; $attrs .= ' type="'.esc_attr($_type).'"'; $attrs .= ' name="'.esc_attr($mailer->mailer.'['.$key.']').'"'; } // Added Classes $classes = esc_attr($mailer->mailer); if(!empty($field['class'])){ $classes .= ' '.esc_attr($field['class']); } // Get value $val = $mailer->getOption($key, $mailer->mailer); if(empty($val)){ $val = isset($field['default']) ? $field['default'] : ''; } $placeholder = empty($field['place_holder']) ? '' : esc_attr($field['place_holder']); $list = empty($field['list']) ? array() : $field['list']; $input_html = ''; switch($field['type']){ case 'radio': foreach($list as $list_key => $list_value){ $input_html .= ' '; } break; case 'checkbox': $input_html .= ''; break; case 'button': $href = empty($field['href']) ? '#' : esc_url($field['href']); $input_html .= ''.esc_html($val).''; break; case 'notice': $input_html .= '
'.esc_html($val).'
'; break; case 'select': $input_html .=''; break; case 'copy': $id = empty($field['id']) ? '' : esc_attr($field['id']); $input_html .= '

'. __('Message coppied Successfully') .'.

'; break; default: $input_html .= ''; break; } $description = empty($field['desc']) ? '' : wp_kses_post($field['desc']); $html .= ' '.esc_html($field['title']).' '.$input_html.'

'.wp_kses_post($description).'

'; } return $html; }