Viewing 13 replies - 1 through 13 (of 13 total)
  • I just got problems when upgrading to PHP 7 which may be related to this.

    Until PHP 5.5 I could use “mail.domain” even if the certificate on the server was issued to the machine name. When upgrading to PHP 7 (and I guess PHP 5.6, but I cannot test it), if I don’t use EXACTLY the machine name on the SMTP Host field, i get:

    Warning: stream_socket_enable_crypto(): Peer certificate CN='the.machine.name' did not match expected CN='mail.domain.used' in /home/labwebdados/public_html/vinha.pt/wp-includes/class-smtp.php on line 343

    I was able to replicate this on both Apache (cPanel) and nginx on PHP 7 but do not have a PHP 5.6 server to test it also.

    same problem resolved by use Iotabi patch.
    thanks a lot!

    Patching a WordPress core file does NOT resolve a problem. Never, ever.

    Thread Starter lotabi

    (@lotabi)

    Hi Webdados, I agree patch core is not the solution, of course.

    consider that
    class-phpmailer.php contemplates SMTPOptions that Plugins shoud set

    I wrote […I suggest To author to add an option “verify_peer” true/false to plugin to override PHP 5.6 default…]

    I take a look of plugin code to do this

    I hope a new version of plugin relased soon

    HTH
    Alessandro

    Hi.
    The plugin simply doesn’t works with upper versions than 5.4
    Even if you are using encryption or not because I’ve upgraded from 5.4 to 5.6 and I had to downgrade the PHP to make it work

    Thread Starter lotabi

    (@lotabi)

    A better solution (avoid patch WP core).

    add these lines on $wpms_options inside wp_mail_smtp.php

    'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false
            )

    The result should be

    global $wpms_options; // This is horrible, should be cleaned up at some point
    $wpms_options = array (
            'mail_from' => '',
            'mail_from_name' => '',
            'mailer' => 'smtp',
            'mail_set_return_path' => 'false',
            'smtp_host' => 'localhost',
            'smtp_port' => '25',
            'smtp_ssl' => 'none',
            'smtp_auth' => false,
            'smtp_user' => '',
            'smtp_pass' => '',
            'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false
            )
    );

    HTH
    Lota

    I find the lack of feedback from the developer on this matter disturbing :-/

    Thread Starter lotabi

    (@lotabi)

    developer updated plugin 4 days ago… Anyway this is a support forum, I opened a ticket here for patch

    https://plugins.trac.wordpress.org/ticket/2486

    Alessandro

    I’m experiencing the same problem, except for the fact that I’m not using encryption, only authentication.

    The problem is that editing the plugin file doesn’t fix the issue!

    It only works if I edit the file in wp-includes, which is not good.

    What could be the problem? Why it is not working?

    “editing the plugin file” and “edit the file in wp-includes” are developer’s famous last words

    There is a filter, you do not need to edit plugin file.

    add_filter('wp_mail_smtp_custom_options','my_wp_mail_smtp_custom_options');
    
    function my_wp_mail_smtp_custom_options($phpmailer){
    
    	$phpmailer->SMTPOptions = [
    		'ssl' => [
    			'verify_peer' => false
    		]
    	];
    
    	return $phpmailer;
    }
    Pacicio

    (@pacicio)

    The function works only if I add “verify_peer_name”, too.

    add_filter('wp_mail_smtp_custom_options','my_wp_mail_smtp_custom_options');
    
    function my_wp_mail_smtp_custom_options($phpmailer) {
    	$phpmailer->SMTPOptions = [
    		'ssl' => [
    			'verify_peer' => false,
    			'verify_peer_name' => false
    		]
    	];
    	return $phpmailer;
    }

    Thanks!

    lotabi worked for me too.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘OpenSSL changes in PHP 5.6.x’ is closed to new replies.