0

The problem I need to solve

I have a web server in a network where the port 25 is blocked for outgoing traffic, and in order to send emails it is mandatory to obtain an account and use authentication.

We then have to connect to a separate mail server using SSL/TLS/STARTTLS (I'm not sure what is what) on port 587. The server uses a self-signed certificate.

In fact, nearly every server use the same self-signed certificate, and it is valid for *.domain.org, but is used on sub.sub.domain.org, sub.sub.sub.domain.org, and so on, causing issues like invalid server alerts on web browsers (but this, as far as I can tell, is not the issue here. Please correct me if I'm wrong).

What I used to do

In the past, I resorted to using the wp-mail-smtp plugin in order to:

reconfigure the wp_mail() function to use SMTP instead of mail() and create an options page to manage the settings.

It worked and I could send emails. Recently, I tried using this plugin again, but it failed.

This time, unlike in the past, I was trying to use it in a multisite environment. The plugin is compatible with multisite and expected to work. In fact, I can use the root wp-config.php file to define mail settings for all the subsites in a single place, and that is a huge advantage to me.

What I need to do

I know this is not the place to look for plugin support, and that's not what I am looking for here. I have managed to successfully send a test email by downloading the latest version of PHPMailer and using (outside WP) a test script with an option to ignore SSL certificates.

Apparently, the issue is caused SSL certificate verification introduced in PHP 5.6, but I have yet to confirm this. I am contacting the plugin author in regards to this, but my question is as follows:

What is the best practice when I have a multisite instance and I need to use a separate SMTP server with a self-signed certificate?

If my research is correct, wp_mail() uses PHPMailer that uses mail(). Someone suggested a configuration on functions.php, but how can that be set for all the subsites of a multisite instance? I don't want to have to manually edit the functions.php file for each new site created, neither I want the admin of each site to know the password for the mail account.

  • have you tried to use this SMTP server in the PHP configuration ? – mmm Aug 25 '15 at 22:55
  • @mmm How can I achieve that? – That Brazilian Guy Aug 25 '15 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.