2
I have a Wordpress Multisite (4.3) on a server where sending emails is blocked. To send emails, an external server with authentication must be used.
By default, the native function wp_mail()
Wordpress internally uses Phpmailer which in turn calls the mail()
PHP. This procedure apparently does not use SMTP(?) and does not allow you to configure authentication or other options.
In the past, I had already used the plugin wp-mail-smtp 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) introduced certificate validation, causing the failure to send unless I use the following parameters:
$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 don’t know how to force Wordpress to apply this setting. No plugin I found supports them, and the solution I found suggests editing the functions.php
, which in my opinion would be a solution that would apply only to that theme on that particular site.
How to make something work for all sub-sites of Multisite?