"; print_r($wp_error); echo ""; } } if(!get_option('sitepad_smtp_options')){ $send_mail['error'] = 1; $send_mail['error_msg'] = _('You have not configured SMTP settings yet !'); }else{ $result = wp_mail($to, $subject, $body); if(!empty($result)){ $send_mail['success'] = 1; }else{ $send_mail['error'] = 1; } } } // Save SMTP details if(isset($_REQUEST['save'])){ // Check nonce check_admin_referer( 'sitepad-options' ); $smtp_host = ''; if(isset($_POST['smtp_host']) && !empty($_POST['smtp_host'])){ $smtp_host = sanitize_text_field($_POST['smtp_host']); } $smtp_auth = ''; if(isset($_POST['smtp_auth']) && (!empty($_POST['smtp_auth']) || $_POST['smtp_auth'] === '0')){ $smtp_auth = sanitize_text_field($_POST['smtp_auth']); } $smtp_username = ''; if(isset($_POST['smtp_username']) && !empty($_POST['smtp_username'])){ $smtp_username = sanitize_text_field($_POST['smtp_username']); } $smtp_password = ''; if(isset($_POST['smtp_password']) && !empty($_POST['smtp_password'])){ //echo "password: ".$_POST['smtp_password']; $smtp_password = sanitize_text_field($_POST['smtp_password']); $smtp_password = wp_unslash($smtp_password); // This removes slash (automatically added by WordPress) from the password when apostrophe is present $smtp_password = base64_encode($smtp_password); } $encryption = ''; if(isset($_POST['encryption']) && !empty($_POST['encryption'])){ $encryption = sanitize_text_field($_POST['encryption']); } $smtp_port = ''; if(isset($_POST['smtp_port']) && !empty($_POST['smtp_port'])){ $smtp_port = sanitize_text_field($_POST['smtp_port']); } /* $smtp_from_mail = ''; if(isset($_POST['smtp_from_mail']) && !empty($_POST['smtp_from_mail'])){ $smtp_from_mail = sanitize_email($_POST['smtp_from_mail']); } $from_name = ''; if(isset($_POST['from_name']) && !empty($_POST['from_name'])){ $from_name = sanitize_text_field(stripslashes($_POST['from_name'])); } */ $disable_ssl_verification = ''; if(isset($_POST['disable_ssl_verification']) && !empty($_POST['disable_ssl_verification'])){ $disable_ssl_verification = sanitize_text_field($_POST['disable_ssl_verification']); } $enable_smtp = ''; if(isset($_POST['enable_smtp']) && !empty($_POST['enable_smtp'])){ $enable_smtp = sanitize_text_field($_POST['enable_smtp']); } $options = array(); $options['enable_smtp'] = $enable_smtp; $options['smtp_host'] = $smtp_host; $options['smtp_auth'] = $smtp_auth; $options['smtp_username'] = $smtp_username; $options['smtp_password'] = $smtp_password; $options['encryption'] = $encryption; $options['smtp_port'] = $smtp_port; //$options['smtp_from_mail'] = $smtp_from_mail; //$options['from_name'] = $from_name; $options['disable_ssl_verification'] = $disable_ssl_verification; if(update_option( 'sitepad_smtp_options', $options )){ $msg['success'] = 1; } } $smtp_options = get_option('sitepad_smtp_options', array()); $smtp_options['enable_smtp'] = isset($smtp_options['enable_smtp'])? $smtp_options['enable_smtp'] : ''; $smtp_options['smtp_from_mail'] = isset($smtp_options['smtp_from_mail'])? $smtp_options['smtp_from_mail'] : ''; $smtp_options['from_name'] = isset($smtp_options['from_name'])? $smtp_options['from_name'] : ''; $smtp_options['smtp_host'] = isset($smtp_options['smtp_host'])? $smtp_options['smtp_host'] : ''; $smtp_options['encryption'] = isset($smtp_options['encryption'])? $smtp_options['encryption'] : ''; $smtp_options['smtp_auth'] = isset($smtp_options['smtp_auth'])? $smtp_options['smtp_auth'] : ''; $smtp_options['disable_ssl_verification'] = isset($smtp_options['disable_ssl_verification'])? $smtp_options['disable_ssl_verification'] : ''; ?>

'.__('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']) ? $send_mail['error_msg'] : __('Unable to send mail, Please check your SMTP details') ).'

'; } ?>
>
>

> > >

>

> >

>

>