Version Description
Download this release
Release Info
| Developer | coffee2code |
| Plugin | |
| Version | 2.5 |
| Comparing to | |
| See all releases | |
Version 2.5
- c2c_minilogo.png +0 -0
- configure-smtp.php +417 -0
- readme.txt +56 -0
- screenshot-1.png +0 -0
c2c_minilogo.png
ADDED
|
Binary file
|
configure-smtp.php
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*
|
| 3 |
+
Plugin Name: Configure SMTP
|
| 4 |
+
Version: 2.5
|
| 5 |
+
Plugin URI: http://coffee2code.com/wp-plugins/configure-smtp
|
| 6 |
+
Author: Scott Reilly
|
| 7 |
+
Author URI: http://coffee2code.com
|
| 8 |
+
Description: Configure SMTP mailing in WordPress, including support for sending e-mail via GMail.
|
| 9 |
+
|
| 10 |
+
This plugin is the renamed, rewritten, and updated version of the wpPHPMailer plugin.
|
| 11 |
+
|
| 12 |
+
Use this plugin to customize the SMTP mailing system used by default by WordPress to handle *outgoing* e-mails.
|
| 13 |
+
It offers you the ability to specify:
|
| 14 |
+
|
| 15 |
+
* SMTP host name
|
| 16 |
+
* SMTP port number
|
| 17 |
+
* If SMTPAuth (authentication) should be used.
|
| 18 |
+
* SMTP username
|
| 19 |
+
* SMTP password
|
| 20 |
+
* If the SMTP connection needs to occur over ssl or tls
|
| 21 |
+
|
| 22 |
+
In addition, you can instead indicate that you wish to use GMail to handle outgoing e-mail, in which case the above
|
| 23 |
+
settings are automatically configured to values appropriate for GMail, though you'll need to specify your GMail
|
| 24 |
+
e-mail (included the "@gmail.com") and password.
|
| 25 |
+
|
| 26 |
+
Regardless of whether SMTP is enabled or configured, the plugin provides you the ability to define the name and
|
| 27 |
+
email of the 'From:' field for all outgoing e-mails.
|
| 28 |
+
|
| 29 |
+
A simple test button is also available that allows you to send a test e-mail to yourself to check if sending
|
| 30 |
+
e-mail has been properly configured for your blog.
|
| 31 |
+
|
| 32 |
+
Compatible with WordPress 2.2+, 2.3+, 2.5+, 2.6+, 2.7+.
|
| 33 |
+
|
| 34 |
+
=>> Read the accompanying readme.txt file for more information. Also, visit the plugin's homepage
|
| 35 |
+
=>> for more information and the latest updates
|
| 36 |
+
|
| 37 |
+
Installation:
|
| 38 |
+
|
| 39 |
+
1. Download the file http://coffee2code.com/wp-plugins/configure-smtp.zip and unzip it into your
|
| 40 |
+
/wp-content/plugins/ directory.
|
| 41 |
+
2. Activate the plugin through the 'Plugins' admin menu in WordPress.
|
| 42 |
+
3. Click the plugin's 'Settings' link next to its 'Deactivate' link (still on the Plugins page), or click on the
|
| 43 |
+
Settings -> SMTP link, to go to the plugin's admin settings page. Optionally customize the settings (to configure it
|
| 44 |
+
if the defaults aren't valid for your situation).
|
| 45 |
+
4. (optional) Use the built-in test to see if your blog can properly send out e-mails.
|
| 46 |
+
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
/*
|
| 50 |
+
Copyright (c) 2004-2009 by Scott Reilly (aka coffee2code)
|
| 51 |
+
|
| 52 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
|
| 53 |
+
files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
|
| 54 |
+
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
| 55 |
+
Software is furnished to do so, subject to the following conditions:
|
| 56 |
+
|
| 57 |
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 58 |
+
|
| 59 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
| 60 |
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 61 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
| 62 |
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 63 |
+
*/
|
| 64 |
+
|
| 65 |
+
if ( !class_exists('ConfigureSMTP') ) :
|
| 66 |
+
|
| 67 |
+
class ConfigureSMTP {
|
| 68 |
+
var $plugin_name = '';
|
| 69 |
+
var $admin_options_name = 'c2c_configure_smtp';
|
| 70 |
+
var $nonce_field = 'update-configure_smtp';
|
| 71 |
+
var $show_admin = true; // Change this to false if you don't want the plugin's admin page shown.
|
| 72 |
+
var $config = array(
|
| 73 |
+
// input can be 'checkbox', 'short_text', 'text', 'textarea', 'inline_textarea', 'select', 'hidden', 'password', or 'none'
|
| 74 |
+
// an input type of 'select' must then have an 'options' value (an array) specified
|
| 75 |
+
// datatype can be 'array' or 'hash'
|
| 76 |
+
// can also specify input_attributes
|
| 77 |
+
'use_gmail' => array('input' => 'checkbox', 'default' => false,
|
| 78 |
+
'label' => 'Send e-mail via GMail?',
|
| 79 |
+
'help' => 'Clicking this will override many of the settings defined below. You will need to input your GMail username and password below.',
|
| 80 |
+
'input_attributes' => 'onclick="return configure_gmail();"'),
|
| 81 |
+
'host' => array('input' => 'text', 'default' => 'localhost',
|
| 82 |
+
'label' => 'SMTP host',
|
| 83 |
+
'help' => 'If "localhost" doesn\'t work for you, check with your host for the SMTP hostname.'),
|
| 84 |
+
'port' => array('input' => 'short_text', 'default' => 25,
|
| 85 |
+
'label' => 'SMTP port',
|
| 86 |
+
'help' => "This is generally 25."),
|
| 87 |
+
'smtp_secure' => array('input' => 'select', 'default' => 'None',
|
| 88 |
+
'label' => 'Secure connection prefix',
|
| 89 |
+
'options' => array('', 'ssl', 'tls'),
|
| 90 |
+
'help' => 'Sets connection prefix for secure connections (prefix method must be supported by your PHP install and your SMTP host)'),
|
| 91 |
+
'smtp_auth' => array('input' => 'checkbox', 'default' => false,
|
| 92 |
+
'label' => 'Use SMTPAuth?',
|
| 93 |
+
'help' => 'If checked, you must provide the SMTP username and password below'),
|
| 94 |
+
'smtp_user' => array('input' => 'text', 'default' => '',
|
| 95 |
+
'label' => 'SMTP username',
|
| 96 |
+
'help' => ''),
|
| 97 |
+
'smtp_pass' => array('input' => 'password', 'default' => '',
|
| 98 |
+
'label' => 'SMTP password',
|
| 99 |
+
'help' => ''),
|
| 100 |
+
'wordwrap' => array('input' => 'short_text', 'default' => '',
|
| 101 |
+
'label' => 'Wordwrap length',
|
| 102 |
+
'help' => 'Sets word wrapping on the body of the message to a given number of characters.'),
|
| 103 |
+
'from_email' => array('input' => 'text', 'default' => '',
|
| 104 |
+
'label' => 'Sender e-mail',
|
| 105 |
+
'help' => 'Sets the From email address for all outgoing messages. Leave blank to use the
|
| 106 |
+
WordPress default. This value will be used even if you don\'t enable SMTP.'),
|
| 107 |
+
'from_name' => array('input' => 'text', 'default' => '',
|
| 108 |
+
'label' => 'Sender name',
|
| 109 |
+
'help' => 'Sets the From name for all outgoing messages. Leave blank to use the WordPress default.
|
| 110 |
+
This value will be used even if you don\'t enable SMTP.')
|
| 111 |
+
);
|
| 112 |
+
var $gmail_config = array(
|
| 113 |
+
'host' => 'smtp.gmail.com',
|
| 114 |
+
'port' => '465',
|
| 115 |
+
'smtp_auth' => true,
|
| 116 |
+
'smtp_secure' => 'ssl'
|
| 117 |
+
);
|
| 118 |
+
var $options = array(); // Don't use this directly
|
| 119 |
+
|
| 120 |
+
function ConfigureSMTP() {
|
| 121 |
+
$this->plugin_name = __('Configure SMTP');
|
| 122 |
+
add_action('admin_head', array(&$this, 'add_js'));
|
| 123 |
+
add_action('admin_menu', array(&$this, 'admin_menu'));
|
| 124 |
+
add_action('phpmailer_init', array(&$this, 'phpmailer_init'));
|
| 125 |
+
add_action('wp_mail_from', array(&$this, 'wp_mail_from'));
|
| 126 |
+
add_action('wp_mail_from_name', array(&$this, 'wp_mail_from_name'));
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
function install() {
|
| 130 |
+
$this->options = $this->get_options();
|
| 131 |
+
update_option($this->admin_options_name, $this->options);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
function add_js() {
|
| 135 |
+
echo <<<JS
|
| 136 |
+
<script type="text/javascript">
|
| 137 |
+
function configure_gmail() {
|
| 138 |
+
if (jQuery('#use_gmail').attr('checked') == true) {
|
| 139 |
+
jQuery('#host').val('{$this->gmail_config['host']}');
|
| 140 |
+
jQuery('#port').val('{$this->gmail_config['port']}');
|
| 141 |
+
jQuery('#smtp_auth').attr('checked', {$this->gmail_config['smtp_auth']});
|
| 142 |
+
jQuery('#smtp_secure').val('{$this->gmail_config['smtp_secure']}');
|
| 143 |
+
if (!jQuery('#smtp_user').val().match(/.+@gmail.com$/) ) {
|
| 144 |
+
jQuery('#smtp_user').val('USERNAME@gmail.com').focus().get(0).setSelectionRange(0,8);
|
| 145 |
+
}
|
| 146 |
+
alert('Be sure to specify your GMail email address (with the @gmail.com) as the SMTP username, and your GMail password as the SMTP password.');
|
| 147 |
+
return true;
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
</script>
|
| 151 |
+
|
| 152 |
+
JS;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
function admin_menu() {
|
| 156 |
+
static $plugin_basename;
|
| 157 |
+
if ( $this->show_admin ) {
|
| 158 |
+
global $wp_version;
|
| 159 |
+
if ( current_user_can('edit_posts') ) {
|
| 160 |
+
$plugin_basename = plugin_basename(__FILE__);
|
| 161 |
+
if ( version_compare( $wp_version, '2.6.999', '>' ) )
|
| 162 |
+
add_filter( 'plugin_action_links_' . $plugin_basename, array(&$this, 'plugin_action_links') );
|
| 163 |
+
add_options_page($this->plugin_name, 'SMTP', 9, $plugin_basename, array(&$this, 'options_page'));
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
function plugin_action_links($action_links) {
|
| 169 |
+
static $plugin_basename;
|
| 170 |
+
if ( !$plugin_basename ) $plugin_basename = plugin_basename(__FILE__);
|
| 171 |
+
$settings_link = '<a href="options-general.php?page='.$plugin_basename.'">' . __('Settings') . '</a>';
|
| 172 |
+
array_unshift( $action_links, $settings_link );
|
| 173 |
+
|
| 174 |
+
return $action_links;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
function phpmailer_init($phpmailer) {
|
| 178 |
+
$options = $this->get_options();
|
| 179 |
+
$phpmailer->IsSMTP();
|
| 180 |
+
$phpmailer->Host = $options['host'];
|
| 181 |
+
$phpmailer->Port = $options['port'] ? $options['port'] : 25;
|
| 182 |
+
$phpmailer->SMTPAuth = $options['smtp_auth'] ? $options['smtp_auth'] : false;
|
| 183 |
+
if ($phpmailer->SMTPAuth) {
|
| 184 |
+
$phpmailer->Username = $options['smtp_user'];
|
| 185 |
+
$phpmailer->Password = $options['smtp_pass'];
|
| 186 |
+
}
|
| 187 |
+
if ($options['smtp_secure'] != '')
|
| 188 |
+
$phpmailer->SMTPSecure = $options['smtp_secure'];
|
| 189 |
+
if ($options['wordwrap'] > 0 )
|
| 190 |
+
$phpmailer->WordWrap = $options['wordwrap'];
|
| 191 |
+
return $phpmailer;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
function wp_mail_from($from) {
|
| 195 |
+
$options = $this->get_options();
|
| 196 |
+
if ($options['from_email'])
|
| 197 |
+
$from = $options['from_email'];
|
| 198 |
+
return $from;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
function wp_mail_from_name($from_name) {
|
| 202 |
+
$options = $this->get_options();
|
| 203 |
+
if ($options['from_name'])
|
| 204 |
+
$from_name = $options['from_name'];
|
| 205 |
+
return $from_name;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
function get_options() {
|
| 209 |
+
if ( !empty($this->options)) return $this->options;
|
| 210 |
+
// Derive options from the config
|
| 211 |
+
$options = array();
|
| 212 |
+
foreach (array_keys($this->config) as $opt) {
|
| 213 |
+
$options[$opt] = $this->config[$opt]['default'];
|
| 214 |
+
}
|
| 215 |
+
$existing_options = get_option($this->admin_options_name);
|
| 216 |
+
if (!empty($existing_options)) {
|
| 217 |
+
foreach ($existing_options as $key => $value)
|
| 218 |
+
$options[$key] = $value;
|
| 219 |
+
}
|
| 220 |
+
$this->options = $options;
|
| 221 |
+
return $options;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
function options_page() {
|
| 225 |
+
static $plugin_basename;
|
| 226 |
+
if ( !$plugin_basename ) $plugin_basename = plugin_basename(__FILE__);
|
| 227 |
+
$options = $this->get_options();
|
| 228 |
+
// See if user has submitted form
|
| 229 |
+
if ( isset($_POST['submitted']) ) {
|
| 230 |
+
check_admin_referer($this->nonce_field);
|
| 231 |
+
|
| 232 |
+
foreach (array_keys($options) AS $opt) {
|
| 233 |
+
$options[$opt] = htmlspecialchars(stripslashes($_POST[$opt]));
|
| 234 |
+
$input = $this->config[$opt]['input'];
|
| 235 |
+
if (($input == 'checkbox') && !$options[$opt])
|
| 236 |
+
$options[$opt] = 0;
|
| 237 |
+
if ($this->config[$opt]['datatype'] == 'array') {
|
| 238 |
+
if ($input == 'text')
|
| 239 |
+
$options[$opt] = explode(',', str_replace(array(', ', ' ', ','), ',', $options[$opt]));
|
| 240 |
+
else
|
| 241 |
+
$options[$opt] = array_map('trim', explode("\n", trim($options[$opt])));
|
| 242 |
+
}
|
| 243 |
+
elseif ($this->config[$opt]['datatype'] == 'hash') {
|
| 244 |
+
if ( !empty($options[$opt]) ) {
|
| 245 |
+
$new_values = array();
|
| 246 |
+
foreach (explode("\n", $options[$opt]) AS $line) {
|
| 247 |
+
list($shortcut, $text) = array_map('trim', explode("=>", $line, 2));
|
| 248 |
+
if (!empty($shortcut)) $new_values[str_replace('\\', '', $shortcut)] = str_replace('\\', '', $text);
|
| 249 |
+
}
|
| 250 |
+
$options[$opt] = $new_values;
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
// If GMail is to be used, those settings take precendence
|
| 255 |
+
if ($options['use_gmail'])
|
| 256 |
+
$options = wp_parse_args($this->gmail_config, $options);
|
| 257 |
+
|
| 258 |
+
// Remember to put all the other options into the array or they'll get lost!
|
| 259 |
+
update_option($this->admin_options_name, $options);
|
| 260 |
+
|
| 261 |
+
echo "<div id='message' class='updated fade'><p><strong>" . __('Settings saved') . '</strong></p></div>';
|
| 262 |
+
}
|
| 263 |
+
elseif ( isset($_POST['submit_test_email']) ) {
|
| 264 |
+
check_admin_referer($this->nonce_field);
|
| 265 |
+
$user = wp_get_current_user();
|
| 266 |
+
$email = $user->user_email;
|
| 267 |
+
$timestamp = current_time('mysql');
|
| 268 |
+
$message = <<<END
|
| 269 |
+
Hi, this is the {$this->plugin_name} plugin e-mailing you a test message from your WordPress blog.
|
| 270 |
+
|
| 271 |
+
This message was sent with this time-stamp: $timestamp
|
| 272 |
+
|
| 273 |
+
Congratulations! Your blog is properly configured to send e-mail.
|
| 274 |
+
END;
|
| 275 |
+
wp_mail($email, "Test message from your WordPress blog", $message);
|
| 276 |
+
//echo "<div class='updated'>I would have sent $email this message:<br />$message</div>";
|
| 277 |
+
echo "<div class='updated'><p>Test e-mail sent.</p><p>The body of the e-mail includes this time-stamp: $timestamp.</p></div>";
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
$action_url = $_SERVER[PHP_SELF] . '?page=' . $plugin_basename;
|
| 281 |
+
$logo = get_option('siteurl') . '/wp-content/plugins/' . basename($_GET['page'], '.php') . '/c2c_minilogo.png';
|
| 282 |
+
|
| 283 |
+
echo <<<END
|
| 284 |
+
<div class='wrap'>
|
| 285 |
+
<div class="icon32" style="width:44px;"><img src='$logo' alt='A plugin by coffee2code' /><br /></div>
|
| 286 |
+
<h2>{$this->plugin_name} Settings</h2>
|
| 287 |
+
<p>After you've configured your SMTP settings, use the <a href="#test">test</a> to send a test message to yourself.</p>
|
| 288 |
+
|
| 289 |
+
<form name="configure_smtp" action="$action_url" method="post">
|
| 290 |
+
END;
|
| 291 |
+
wp_nonce_field($this->nonce_field);
|
| 292 |
+
echo '<table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform form-table">';
|
| 293 |
+
foreach (array_keys($options) as $opt) {
|
| 294 |
+
$input = $this->config[$opt]['input'];
|
| 295 |
+
if ($input == 'none') continue;
|
| 296 |
+
$label = $this->config[$opt]['label'];
|
| 297 |
+
$value = $options[$opt];
|
| 298 |
+
if ($input == 'checkbox') {
|
| 299 |
+
$checked = ($value == 1) ? 'checked=checked ' : '';
|
| 300 |
+
$value = 1;
|
| 301 |
+
} else {
|
| 302 |
+
$checked = '';
|
| 303 |
+
};
|
| 304 |
+
if ($this->config[$opt]['datatype'] == 'array') {
|
| 305 |
+
if ($input == 'textarea' || $input == 'inline_textarea')
|
| 306 |
+
$value = implode("\n", $value);
|
| 307 |
+
else
|
| 308 |
+
$value = implode(', ', $value);
|
| 309 |
+
} elseif ($this->config[$opt]['datatype'] == 'hash') {
|
| 310 |
+
$new_value = '';
|
| 311 |
+
foreach ($value AS $shortcut => $replacement) {
|
| 312 |
+
$new_value .= "$shortcut => $replacement\n";
|
| 313 |
+
}
|
| 314 |
+
$value = $new_value;
|
| 315 |
+
}
|
| 316 |
+
echo "<tr valign='top'>";
|
| 317 |
+
if ($input == 'textarea') {
|
| 318 |
+
echo "<td colspan='2'>";
|
| 319 |
+
if ($label) echo "<strong>$label</strong><br />";
|
| 320 |
+
echo "<textarea name='$opt' id='$opt' {$this->config[$opt]['input_attributes']}>" . $value . '</textarea>';
|
| 321 |
+
} else {
|
| 322 |
+
echo "<th scope='row'>$label</th><td>";
|
| 323 |
+
if ($input == "inline_textarea")
|
| 324 |
+
echo "<textarea name='$opt' id='$opt' {$this->config[$opt]['input_attributes']}>" . $value . '</textarea>';
|
| 325 |
+
elseif ($input == 'select') {
|
| 326 |
+
echo "<select name='$opt' id='$opt'>";
|
| 327 |
+
foreach ($this->config[$opt]['options'] as $sopt) {
|
| 328 |
+
$selected = $value == $sopt ? " selected='selected'" : '';
|
| 329 |
+
echo "<option value='$sopt'$selected>$sopt</option>";
|
| 330 |
+
}
|
| 331 |
+
echo "</select>";
|
| 332 |
+
} else {
|
| 333 |
+
$tclass = ($input == 'short_text') ? 'small-text' : 'regular-text';
|
| 334 |
+
if ($input == 'short_text') $input = 'text';
|
| 335 |
+
echo "<input name='$opt' type='$input' id='$opt' value='$value' class='$tclass' $checked {$this->config[$opt]['input_attributes']} />";
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
if ($this->config[$opt]['help']) {
|
| 339 |
+
echo "<br /><span style='color:#777; font-size:x-small;'>";
|
| 340 |
+
echo $this->config[$opt]['help'];
|
| 341 |
+
echo "</span>";
|
| 342 |
+
}
|
| 343 |
+
echo "</td></tr>";
|
| 344 |
+
}
|
| 345 |
+
echo <<<END
|
| 346 |
+
</table>
|
| 347 |
+
<input type="hidden" name="submitted" value="1" />
|
| 348 |
+
<div class="submit"><input type="submit" name="Submit" class="button-primary" value="Save Changes" /></div>
|
| 349 |
+
</form>
|
| 350 |
+
</div>
|
| 351 |
+
END;
|
| 352 |
+
echo <<<END
|
| 353 |
+
<style type="text/css">
|
| 354 |
+
#c2c {
|
| 355 |
+
text-align:center;
|
| 356 |
+
color:#888;
|
| 357 |
+
background-color:#ffffef;
|
| 358 |
+
padding:5px 0 0;
|
| 359 |
+
margin-top:12px;
|
| 360 |
+
border-style:solid;
|
| 361 |
+
border-color:#dadada;
|
| 362 |
+
border-width:1px 0;
|
| 363 |
+
}
|
| 364 |
+
#c2c div {
|
| 365 |
+
margin:0 auto;
|
| 366 |
+
padding:5px 40px 0 0;
|
| 367 |
+
width:45%;
|
| 368 |
+
min-height:40px;
|
| 369 |
+
background:url('$logo') no-repeat top right;
|
| 370 |
+
}
|
| 371 |
+
#c2c span {
|
| 372 |
+
display:block;
|
| 373 |
+
font-size:x-small;
|
| 374 |
+
}
|
| 375 |
+
</style>
|
| 376 |
+
<div id='c2c' class='wrap'>
|
| 377 |
+
<div>
|
| 378 |
+
This plugin brought to you by <a href="http://coffee2code.com" title="coffee2code.com">Scott Reilly, aka coffee2code</a>.
|
| 379 |
+
<span><a href="http://coffee2code.com/donate" title="Please consider a donation">Did you find this plugin useful?</a></span>
|
| 380 |
+
</div>
|
| 381 |
+
</div>
|
| 382 |
+
END;
|
| 383 |
+
$user = wp_get_current_user();
|
| 384 |
+
$email = $user->user_email;
|
| 385 |
+
echo <<<END
|
| 386 |
+
<div class='wrap'>
|
| 387 |
+
<h2><a name="test"></a>Send A Test</h2>
|
| 388 |
+
<p>Click the button below to send a test email to yourself to see if things are working. Be sure to save
|
| 389 |
+
any changes you made to the form above before sending the test e-mail. Bear in mind it may take a few
|
| 390 |
+
minutes for the e-mail to wind its way through the internet.</p>
|
| 391 |
+
|
| 392 |
+
<p>This e-mail will be sent to your e-mail address, $email.</p>
|
| 393 |
+
|
| 394 |
+
<form name="configure_smtp" action="$action_url" method="post">
|
| 395 |
+
END;
|
| 396 |
+
wp_nonce_field($this->nonce_field);
|
| 397 |
+
echo <<<END
|
| 398 |
+
<input type="hidden" name="submit_test_email" value="1" />
|
| 399 |
+
<div class="submit"><input type="submit" name="Submit" value="Send test e-mail" /></div>
|
| 400 |
+
</form>
|
| 401 |
+
</div>
|
| 402 |
+
END;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
} // end ConfigureSMTP
|
| 406 |
+
|
| 407 |
+
endif; // end if !class_exists()
|
| 408 |
+
if ( class_exists('ConfigureSMTP') ) :
|
| 409 |
+
// Get the ball rolling
|
| 410 |
+
$configure_smtp = new ConfigureSMTP();
|
| 411 |
+
// Actions and filters
|
| 412 |
+
if (isset($configure_smtp)) {
|
| 413 |
+
register_activation_hook( __FILE__, array(&$configure_smtp, 'install') );
|
| 414 |
+
}
|
| 415 |
+
endif;
|
| 416 |
+
|
| 417 |
+
?>
|
readme.txt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== Configure SMTP ===
|
| 2 |
+
Contributors: coffee2code
|
| 3 |
+
Donate link: http://coffee2code.com/donate
|
| 4 |
+
Tags: email, smtp, gmail, sendmail, wp_mail, phpmailer, outgoing mail, coffee2code
|
| 5 |
+
Requires at least: 2.2
|
| 6 |
+
Tested up to: 2.7.1
|
| 7 |
+
Stable tag: 2.5
|
| 8 |
+
Version: 2.5
|
| 9 |
+
|
| 10 |
+
Configure SMTP mailing in WordPress, including support for sending e-mail via SSL/TLS (such as GMail).
|
| 11 |
+
|
| 12 |
+
== Description ==
|
| 13 |
+
|
| 14 |
+
Configure SMTP mailing in WordPress, including support for sending e-mail via SSL/TLS (such as GMail).
|
| 15 |
+
|
| 16 |
+
This plugin is the renamed, rewritten, and updated version of the wpPHPMailer plugin.
|
| 17 |
+
|
| 18 |
+
Use this plugin to customize the SMTP mailing system used by default by WordPress to handle *outgoing* e-mails. It offers you the ability to specify:
|
| 19 |
+
|
| 20 |
+
* SMTP host name
|
| 21 |
+
* SMTP port number
|
| 22 |
+
* If SMTPAuth (authentication) should be used.
|
| 23 |
+
* SMTP username
|
| 24 |
+
* SMTP password
|
| 25 |
+
* If the SMTP connection needs to occur over ssl or tls
|
| 26 |
+
|
| 27 |
+
In addition, you can instead indicate that you wish to use GMail to handle outgoing e-mail, in which case the above settings are automatically configured to values appropriate for GMail, though you'll need to specify your GMail e-mail (including the "@gmail.com") and password.
|
| 28 |
+
|
| 29 |
+
Regardless of whether SMTP is enabled, the plugin provides you the ability to define the name and email of the 'From:' field for all outgoing e-mails.
|
| 30 |
+
|
| 31 |
+
A simple test button is also available that allows you to send a test e-mail to yourself to check if sending e-mail has been properly configured for your blog.
|
| 32 |
+
|
| 33 |
+
== Installation ==
|
| 34 |
+
|
| 35 |
+
1. Unzip `configure-smtp.zip` inside the `/wp-content/plugins/` directory
|
| 36 |
+
1. Activate the plugin through the 'Plugins' admin menu in WordPress
|
| 37 |
+
1. Click the plugin's `Settings` link next to its `Deactivate` link (still on the Plugins page), or click on the `Settings` -> `SMTP` link, to go to the plugin's admin settings page. Optionally customize the settings (to configure it if the defaults aren't valid for your situation).
|
| 38 |
+
1. (optional) Use the built-in test to see if your blog can properly send out e-mails.
|
| 39 |
+
|
| 40 |
+
== Frequently Asked Questions =
|
| 41 |
+
|
| 42 |
+
= I am already able to receive e-mail sent by my blog, so would I have any use or need for this plugin? =
|
| 43 |
+
|
| 44 |
+
Most likely, no. Not unless you have a preference for having your mail sent out via a different SMTP server, such as GMail.
|
| 45 |
+
|
| 46 |
+
= How do I find out my SMTP host, and/or if I need to use SMTPAuth and what my username and password for that are? =
|
| 47 |
+
|
| 48 |
+
Check out the settings for your local e-mail program. More than likely that is configured to use an outgoing SMTP server. Otherwise, contact your host or someone more intimately knowledgeable about your situation.
|
| 49 |
+
|
| 50 |
+
= I've sent out a few test e-mails using the test button after having tried different values for some of the settings; how do I know which one worked? =
|
| 51 |
+
|
| 52 |
+
If your settings worked, you should receive the test e-mail at e-mail address associated with your WordPress blog user account. That e-mail contains a time-stamp which was reported to you by the plugin when the e-mail was sent. If you are trying out various setting values, be sure to record what your settings were and what the time-stamp was when sending with those settings.
|
| 53 |
+
|
| 54 |
+
== Screenshots ==
|
| 55 |
+
|
| 56 |
+
1. A screenshot of the plugin's admin settings page.
|
screenshot-1.png
ADDED
|
Binary file
|
