Support » Plugin: WP Mail SMTP by WPForms » stream_socket_enable_crypto(): SSL operation failed with code 1

  • After upgrading PHP to 5.6 or 7, every attempt to send an email fail and the following error message is shown:

    Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /xpto/xpto/xpto/public_html/wp-includes/class-smtp.php on line 343

    https://wordpress.org/plugins/wp-mail-smtp/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Same issue here.

    I have upgraded from PHP 5.3 to 5.6, and suddenly I get this error. Any suggestion?

    Put this code before line 149 ($phpmailer = apply_filters('wp_mail_smtp_custom_options', $phpmailer);)

    $phpmailer->SMTPOptions = array(
    			'ssl' => array(
    				'verify_peer' => false,
    				'verify_peer_name' => false,
    				'allow_self_signed' => true
    				)
    			);
    		}

    In file wp_mail_smtp.php inside plugin folder.

    enreas

    (@juandiegogutirrezgallardo)

    Just as Bruno said, but with a minor change:

    $phpmailer->SMTPOptions = array(
    	'ssl' => array(
    		'verify_peer' => false,
    		'verify_peer_name' => false,
    		'allow_self_signed' => true
    	)
    );

    That is, removing the closing curly bracket at the end.

    Do not edit the plugin code.

    This should be fixed by the developer.

    yes the additions worked , well done.

    The plugin should not be available as it is faulty without it..

    Is there anybody out there?

    Actually this only happens when you use a server hostname not exactly the same as the one the digital certificate was issued to.

    If you try to set up an account on Outlook, Mail.app, etc… and do the same, you’ll have get warnings / errors.

    Maybe this should not be seen as a bug, but as an option to either ignore the hostname mismatch or not.

    This is a bug and it needs to be fixed up. You cant ignore the error as no message will be sent.

    “Actually this only happens when you use a server hostname not exactly the same as the one the digital certificate was issued to.”

    Need some convincing of this one!

    @jagguy2

    I can give you a real case scenario:

    My company dedicated server has a valid digital certificate on the WHM/cPanel domain: servername.ourdomain.com (example domain) so that all WHM/cPanel traffic is handled over https. This certificate is also used for POP/SMTP/IMAP connections.

    On this server we host several domains (ours and clients). When someone sets up an email client (like Outlook or Mail.app or any other) to connect to our server via SSL, if he uses mail.hisdomain.com instead of servername.ourdomain.com he’ll (correctly) get an error (or at least a warning) that the SSL certificate is not issued to the domain he’s connecting to although it’s the same server/IP. It’s actually not the same domain.

    Even cPanel instructions on how to setup an email client are clear that the hostname used should be the one the SSL certificate is issued to:

    Unless you don’t want to use SSL, and then you can use your own domain hostname:

    So, contrarily to my initial reaction on this issue, I do think this is actually pretty standard: do not connect securely to a server if the SSL certificate is not valid for the provided hostname.

    @jagguy2

    Before replying you should see the plugin changelog and the code itself. This is resolved in the last update.

    In the last version the author did add a filter, you can use it in your functions.php file like this:

    
    function your_smtp_options($phpmailer){
    	$phpmailer->SMTPOptions = array(
    		'ssl' => array(
    			'verify_peer' => false,
    			'verify_peer_name' => false,
    			'allow_self_signed' => true
    		)
    	);
    	return $phpmailer;
    }
    
    add_filter( 'wp_mail_smtp_custom_options', 'your_smtp_options' );
    
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘stream_socket_enable_crypto(): SSL operation failed with code 1’ is closed to new replies.