enter your server settings before WordPress will use SMTP; until then, it will continue to use mail(). Author: Jason Verber Version: 0.9 Author URI: http://noprerequisite.com */ add_option('np_qdsmtp_Host', ''); add_option('np_qdsmtp_SMTPAuth', ''); add_option('np_qdsmtp_Username', ''); add_option('np_qdsmtp_Password', ''); add_action('admin_menu','np_qdsmtp_options_page'); function np_qdsmtp_options_form() { if ( isset($_POST['np_qdsmtp_update_options']) ) { if ( !empty($_POST['np_qdsmtp_smtpauth']) ) { update_option('np_qdsmtp_SMTPAuth', "true"); } else { update_option('np_qdsmtp_SMTPAuth', "false"); } update_option('np_qdsmtp_Host', $_POST['np_qdsmtp_host']); update_option('np_qdsmtp_Username', $_POST['np_qdsmtp_username']); update_option('np_qdsmtp_Password', $_POST['np_qdsmtp_password']); } $host = get_option('np_qdsmtp_Host'); $smtpauth = get_option('np_qdsmtp_SMTPAuth'); $username = get_option('np_qdsmtp_Username'); $password = get_option('np_qdsmtp_Password'); //set up option checkbox values if ('true' == $smtpauth) { $authenticate = 'checked="true"'; } else { $authenticate = ''; } ?>

Quick & Dirty SMTP Options

To use this plugin, input your server settings below:

Host = get_option('np_qdsmtp_Host'); // SMTP servers $phpmailer->SMTPAuth = get_option('np_qdsmtp_SMTPAuth'); // turn on SMTP authentication $phpmailer->Username = get_option('np_qdsmtp_Username'); // SMTP username $phpmailer->Password = get_option('np_qdsmtp_Password'); // SMTP password if ($phpmailer->Host!="") { $phpmailer->IsSMTP(); } else { $phpmailer->IsMail(); } // send via SMTP if SMTP server set $phpmailer->ClearAddresses(); $phpmailer->ClearCCs(); $phpmailer->ClearBCCs(); $phpmailer->ClearReplyTos(); $phpmailer->ClearAllRecipients(); $phpmailer->ClearCustomHeaders(); $phpmailer->FromName = "WordPress"; $phpmailer->AddAddress("$to", ""); $phpmailer->Subject = $subject; $phpmailer->Body = $message; $phpmailer->IsHTML(false); //$phpmailer->IsMail(); // set mailer to use php mail() do_action_ref_array('phpmailer_init', array(&$phpmailer)); $mailheaders = (array) explode( "\n", $headers ); foreach ( $mailheaders as $line ) { $header = explode( ":", $line ); switch ( trim( $header[0] ) ) { case "From": $from = trim( str_replace( '"', '', $header[1] ) ); if ( strpos( $from, '<' ) ) { $phpmailer->FromName = str_replace( '"', '', substr( $header[1], 0, strpos( $header[1], '<' ) - 1 ) ); $from = trim( substr( $from, strpos( $from, '<' ) + 1 ) ); $from = str_replace( '>', '', $from ); } else { $phpmailer->FromName = $from; } $phpmailer->From = trim( $from ); break; default: if ( $line != '' && $header[0] != 'MIME-Version' && $header[0] != 'Content-Type' ) $phpmailer->AddCustomHeader( $line ); break; } } $result = @$phpmailer->Send(); return $result; } endif; ?>