• Resolved Rodrigo Macedo

    (@unionforwebdesigner)


    Hello good day,

    I’m having trouble using this plugin with PHP version 7, I browsed around the plugin support forum, and the only topic I found was about a member asking if the plugin was compatible with PHP version 7.

    Apparently the plugin is compatible with version 7, however it returns the following error after configuring and performing the tests:

    Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: 
    error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
    
    Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): Failed to enable crypto
    
    Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://localhost:465 (Unknown error)
    
    SMTP ERROR: Failed to connect to server:  (0)
    
    SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

    I ran the tests with all versions available on my server and the plugin itself works with versions 5.4 and 5.5, the later versions return this error.

    Apparently the problem that is happening is the SSL certificate verification as per the PHPMailer documentation:

    https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#php-56-certificate-verification-failure

    In the documentation it explains that the correct one would be to replace the invalid, badly configured or self-signed certificate, but I have already contacted my server and I was informed that it does not have an SSL certificate for email shots, so failing that I would use The second option which is in the PHPMailer documentation, allow for insecure connections via SMTPOptions.Although it is not recommended, below is a code that can be added:

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

    I would like to know if you can help me with this, where can I add this code so that you can continue to use PHP version 7?

    After all it is highly recommended to use more updated versions since version 5.6 will soon become obsolete in security issues.

    Thank you in advance.

    Best regards,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, my problem is the same, help me!

    Thread Starter Rodrigo Macedo

    (@unionforwebdesigner)

    The Developer or Support of this plugin seems to have abandoned the same, take days or even weeks for them to see or respond.

    Before opening this Topic I’ve been looking at others and had open threads for unanswered weeks.

    By the way, the solution is to try to look for an alternative.

    If you are having the same problem I think you should not expect too much from the developer nor the support of this plugin @ccastilla.

    You can insert the given code in line 148 of wp_mail_smtp.php as follows:

    // If we're sending via SMTP, set the host
    		if (get_option('mailer') == "smtp") {
    
    			// Set the SMTPSecure value, if set to none, leave this blank
    			$phpmailer->SMTPSecure = get_option('smtp_ssl') == 'none' ? '' : get_option('smtp_ssl');
    
    			// Set the other options
    			$phpmailer->Host = get_option('smtp_host');
    			$phpmailer->Port = get_option('smtp_port'); 
    			
    			// https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
    			// https://php.net/manual/en/migration56.openssl.php
    			$phpmailer->SMTPOptions = array(
    				'ssl' => array(
    					'verify_peer' => false,
    					'verify_peer_name' => false,
    					'allow_self_signed' => true
    				)
    			);
    
    			// If we're using smtp auth, set the username & password
    			if (get_option('smtp_auth') == "true") {
    				$phpmailer->SMTPAuth = TRUE;
    				$phpmailer->Username = get_option('smtp_user');
    				$phpmailer->Password = get_option('smtp_pass');
    			}
    		} 
    

    Just replace $mail with $phpmailer. Worked for me.

    Plugin Author Slava Abakumov

    (@slaffik)

    It’s relevant for SMTP only with a misconfigured server.

    You can place this snippet:
    https://gist.github.com/slaFFik/c1d7d4249f47da7195fb973109952090

    Here is the tutorial on where and how to do that: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

    That will allow you to bypass the problem. Not recommended though, as it’s better to fix the server configuration.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problems with PHP version 5.6 or later’ is closed to new replies.