I have a WordPress Multisite (4.3) on a server where the sending of emails is blocked. To send e-mail, an external server with authentication must be used.
By default, WordPress's native wp_mail()
veloper function internally uses PHPMailer which in turn calls PHP's mail()
fault. This procedure apparently does not use SMTP (?) And does not allow you to configure authentication or other options.
In the past, I had used the wp-mail-smtp plugin to force the use of SMTP and fill in the authentication data.
However, the mail server uses a self-signed certificate and apparently from PHP 5.6 (which is the version used by WP) has introduced certificate validation, causing failure to send, unless I use the following parameters: / p>
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
( source )
I can successfully send emails from a test script. But I do not know how to force WordPress to apply this setting. No plugin I found supports them, and the solution I found suggests editing functions.php
, which my seeing would be a solution that would only apply to that theme on that particular site.
How do I make something work for all multisite sub-sites?