芝麻web文件管理V1.00
编辑当前文件:/home/prismawe/www/itrema/wp-content/plugins/wp-mail-smtp/wp_mail_smtp.php
Sender if true define('WPMS_SMTP_HOST', 'localhost'); // The SMTP mail host define('WPMS_SMTP_PORT', 25); // The SMTP server port number define('WPMS_SSL', ''); // Possible values '', 'ssl', 'tls' - note TLS is not STARTTLS define('WPMS_SMTP_AUTH', true); // True turns on SMTP authentication, false turns it off define('WPMS_SMTP_USER', 'username'); // SMTP authentication username, only used if WPMS_SMTP_AUTH is true define('WPMS_SMTP_PASS', 'password'); // SMTP authentication password, only used if WPMS_SMTP_AUTH is true */ // Array of options and their default values global $wpms_options; // This is horrible, should be cleaned up at some point $wpms_options = array ( 'mail_from' => '', 'mail_from_name' => '', 'mailer' => 'smtp', 'mail_set_return_path' => 'false', 'smtp_host' => 'localhost', 'smtp_port' => '25', 'smtp_ssl' => 'none', 'smtp_auth' => false, 'smtp_user' => '', 'smtp_pass' => '' ); /** * Activation function. This function creates the required options and defaults. */ if (!function_exists('wp_mail_smtp_activate')) : function wp_mail_smtp_activate() { global $wpms_options; // Create the required options... foreach ($wpms_options as $name => $val) { add_option($name,$val); } } endif; if (!function_exists('wp_mail_smtp_whitelist_options')) : function wp_mail_smtp_whitelist_options($whitelist_options) { global $wpms_options; // Add our options to the array $whitelist_options['email'] = array_keys($wpms_options); return $whitelist_options; } endif; // To avoid any (very unlikely) clashes, check if the function alredy exists if (!function_exists('phpmailer_init_smtp')) : // This code is copied, from wp-includes/pluggable.php as at version 2.2.2 function phpmailer_init_smtp($phpmailer) { // If constants are defined, apply those options if (defined('WPMS_ON') && WPMS_ON) { $phpmailer->Mailer = WPMS_MAILER; if (WPMS_SET_RETURN_PATH) $phpmailer->Sender = $phpmailer->From; if (WPMS_MAILER == 'smtp') { $phpmailer->SMTPSecure = WPMS_SSL; $phpmailer->Host = WPMS_SMTP_HOST; $phpmailer->Port = WPMS_SMTP_PORT; if (WPMS_SMTP_AUTH) { $phpmailer->SMTPAuth = true; $phpmailer->Username = WPMS_SMTP_USER; $phpmailer->Password = WPMS_SMTP_PASS; } } // If you're using contstants, set any custom options here } else { // Check that mailer is not blank, and if mailer=smtp, host is not blank if ( ! get_option('mailer') || ( get_option('mailer') == 'smtp' && ! get_option('smtp_host') ) ) { return; } // Set the mailer type as per config above, this overrides the already called isMail method $phpmailer->Mailer = get_option('mailer'); // Set the Sender (return-path) if required if (get_option('mail_set_return_path')) $phpmailer->Sender = $phpmailer->From; // Set the SMTPSecure value, if set to none, leave this blank $phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl'); // If we're sending via SMTP, set the host if (get_option('mailer') == "smtp") { // Set the SMTPSecure value, if set to none, leave this blank $phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl'); // Set the other options $phpmailer->Host = get_option('smtp_host'); $phpmailer->Port = get_option('smtp_port'); // If we're using smtp auth, set the username & password if (get_option('smtp_auth') == "true") { $phpmailer->SMTPAuth = TRUE; $phpmailer->Username = get_option('smtp_user'); $phpmailer->Password = get_option('smtp_pass'); } } // You can add your own options here, see the phpmailer documentation for more info: // http://phpmailer.sourceforge.net/docs/ // STOP adding options here. } } // End of phpmailer_init_smtp() function definition endif; /** * This function outputs the plugin options page. */ if (!function_exists('wp_mail_smtp_options_page')) : // Define the function function wp_mail_smtp_options_page() { // Load the options global $wpms_options, $phpmailer; // Make sure the PHPMailer class has been instantiated // (copied verbatim from wp-includes/pluggable.php) // (Re)create it, if it's gone missing if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { require_once ABSPATH . WPINC . '/class-phpmailer.php'; require_once ABSPATH . WPINC . '/class-smtp.php'; $phpmailer = new PHPMailer(); } // Send a test mail if necessary if (isset($_POST['wpms_action']) && $_POST['wpms_action'] == __('Send Test', 'wp_mail_smtp') && isset($_POST['to'])) { // Set up the mail variables $to = $_POST['to']; $subject = 'WP Mail SMTP: ' . __('Test mail to ', 'wp_mail_smtp') . $to; $message = __('This is a test email generated by the WP Mail SMTP WordPress plugin.', 'wp_mail_smtp'); // Set SMTPDebug to level 2 $phpmailer->SMTPDebug = 2; // Start output buffering to grab smtp debugging output ob_start(); // Send the test mail $result = wp_mail($to,$subject,$message); // Strip out the language strings which confuse users //unset($phpmailer->language); // This property became protected in WP 3.2 // Grab the smtp debugging output $smtp_debug = ob_get_clean(); // Output the response ?>
'); _e('
Please Note:
You appear to be using a version of WordPress prior to 2.3. Please ignore the From Name field and instead enter Name<email@domain.com> in this field.', 'wp_mail_smtp'); print('
'); } ?>
/>
/>
/>
/>
/>
/>
/>
/>
' . __( 'Settings', 'wp_mail_smtp' ) . ''; array_unshift( $links, $settings_link ); return $links; } // Add an action on phpmailer_init add_action('phpmailer_init','phpmailer_init_smtp'); if (!defined('WPMS_ON') || !WPMS_ON) { // Whitelist our options add_filter('whitelist_options', 'wp_mail_smtp_whitelist_options'); // Add the create pages options add_action('admin_menu','wp_mail_smtp_menus'); // Add an activation hook for this plugin register_activation_hook(__FILE__,'wp_mail_smtp_activate'); // Adds "Settings" link to the plugin action page add_filter( 'plugin_action_links', 'wp_mail_plugin_action_links',10,2); } // Add filters to replace the mail from name and emailaddress add_filter('wp_mail_from','wp_mail_smtp_mail_from'); add_filter('wp_mail_from_name','wp_mail_smtp_mail_from_name'); load_plugin_textdomain('wp_mail_smtp', false, dirname(plugin_basename(__FILE__)) . '/langs'); ?>