[wp-trac] [WordPress Trac] #41344: Secure Email Integration
WordPress Trac
noreply at wordpress.org
Sun Aug 6 21:56:11 UTC 2017
#41344: Secure Email Integration
-------------------------+----------------------------------------
Reporter: ina2n | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: 4.8
Severity: normal | Resolution:
Keywords: | Focuses: administration, multisite
-------------------------+----------------------------------------
Changes (by SergeyBiryukov):
* component: Administration => Mail
Old description:
> By the time an entrepreneur decides to use WP multisite, the need for
> extensive email integration is a requirement. Whether the new startup
> company is on shared or dedicated hosting, the need for proper secure
> email integration into their WP sites is a must. The necessary code to
> deliver secure email with PHPMailer is minimal, and the need to do so in
> today's email environment is critical.
>
> As you may know, Gmail (possibly others) has placed more strict
> requirements on using their SMTP email servers for outside accounts, and
> this has created a greater need for private email servers.
>
> Please integrate secure email into WP multisite core with proper admin
> menus. I've been using the following code as a personal plugin for more
> than a year:
>
> <?php
> defined( 'ABSPATH' ) OR exit;
> /**
> * Plugin Name: WP Simple SMTP Settings
> * Description: Simple SMTP server settings with SSL/TLS for PHPMailer,
> expressly designed to enable Wordpress to send emails with s self-signed
> certificate on their private email server.
> * Author: ina2n
> * Author URL: https://ina2n.com
> * License: GPLv2 or later
> * License URI: http://www.gnu.org/licenses/gpl-2.0.html
> */
> add_action( 'phpmailer_init', 'phpmailerSMTP' );
> function phpmailerSMTP( $phpmailer ) {
> $phpmailer->IsSMTP();
> $phpmailer->Host = 'mail.youremailserver.com'; // SMTP Host
> $phpmailer->SMTPAuth = true; // Authentication, other option is
> false, but reckless and ill advised
> $phpmailer->Username = 'yourusername at youremailserver.com';
> $phpmailer->Password = 'yourpassword';
> $phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another
> possible value
> $phpmailer->Port = 587; // SMTP Port
> $phpmailer->SMTPOptions = array (
> 'ssl' => array('verify_peer' => false,'verify_peer_name' =>
> false,'allow_self_signed' => true)); //Enable SMTP on email servers with
> self-signed certificates
> // The following settings are optional and can be set for static emails,
> however, if you're using a dynamic email newsletter plugin such as
> Woocommerce or SendPress, then you want to comment out these lines by
> leaving the // at the front of each line. Any variables placed here will
> override all other email sending plugins. You can change any one of these
> settings to override all email sending plugins. For example, you might
> want your email 'FromName' to read as your company name, regardless of
> what you have setup in Woocommerce, SendPress or other email sending
> plugins.
> // $phpmailer->From = 'yourusername at youremailserver.com';
> // $phpmailer->FromName = 'Your Company Name'; //This can be
> your company, website, or your your name
> // $phpmailer->Subject = 'Your Company Title'; // Leave this
> blank '' if you don't want the subject line automatically populated
> // $phpmailer->SMTPDebug = 2;
> // 1: show client -> server messages only. Don't use this - it's
> very unlikely to tell you anything useful.
> // 2: show client -> server and server -> client messages - this is
> usually the setting you want
> // 3: As 2, but also show details about the initial connection; only
> use this if you're having trouble connecting (e.g. connection timing out)
> // 4: As 3, but also shows detailed low-level traffic. Only really
> useful for analysing protocol-level bugs, very verbose, probably not what
> you need.
> }
New description:
By the time an entrepreneur decides to use WP multisite, the need for
extensive email integration is a requirement. Whether the new startup
company is on shared or dedicated hosting, the need for proper secure
email integration into their WP sites is a must. The necessary code to
deliver secure email with PHPMailer is minimal, and the need to do so in
today's email environment is critical.
As you may know, Gmail (possibly others) has placed more strict
requirements on using their SMTP email servers for outside accounts, and
this has created a greater need for private email servers.
Please integrate secure email into WP multisite core with proper admin
menus. I've been using the following code as a personal plugin for more
than a year:
{{{
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: WP Simple SMTP Settings
* Description: Simple SMTP server settings with SSL/TLS for PHPMailer,
expressly designed to enable Wordpress to send emails with s self-signed
certificate on their private email server.
* Author: ina2n
* Author URL: https://ina2n.com
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
add_action( 'phpmailer_init', 'phpmailerSMTP' );
function phpmailerSMTP( $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->Host = 'mail.youremailserver.com'; // SMTP Host
$phpmailer->SMTPAuth = true; // Authentication, other option is false,
but reckless and ill advised
$phpmailer->Username = 'yourusername at youremailserver.com';
$phpmailer->Password = 'yourpassword';
$phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another
possible value
$phpmailer->Port = 587; // SMTP Port
$phpmailer->SMTPOptions = array (
'ssl' => array('verify_peer' => false,'verify_peer_name' =>
false,'allow_self_signed' => true)); //Enable SMTP on email servers with
self-signed certificates
// The following settings are optional and can be set for static emails,
however, if you're using a dynamic email newsletter plugin such as
Woocommerce or SendPress, then you want to comment out these lines by
leaving the // at the front of each line. Any variables placed here will
override all other email sending plugins. You can change any one of these
settings to override all email sending plugins. For example, you might
want your email 'FromName' to read as your company name, regardless of
what you have setup in Woocommerce, SendPress or other email sending
plugins.
// $phpmailer->From = 'yourusername at youremailserver.com';
// $phpmailer->FromName = 'Your Company Name'; //This can be your
company, website, or your your name
// $phpmailer->Subject = 'Your Company Title'; // Leave this
blank '' if you don't want the subject line automatically populated
// $phpmailer->SMTPDebug = 2;
// 1: show client -> server messages only. Don't use this - it's very
unlikely to tell you anything useful.
// 2: show client -> server and server -> client messages - this is
usually the setting you want
// 3: As 2, but also show details about the initial connection; only
use this if you're having trouble connecting (e.g. connection timing out)
// 4: As 3, but also shows detailed low-level traffic. Only really
useful for analysing protocol-level bugs, very verbose, probably not what
you need.
}
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41344#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list