0
Hello, yesterday when sending an email by my site and my client created by wordpress, I came across an error sending the email:
Warning: stream_socket_enable_crypto(): Peer certificate CN=`*.locaweb.com.br' did not match expected CN=`smtp.toldosmaranata.com.br' in /home/storage/2/f3/41/toldosmaranata/public_html/wp-includes/class-smtp.php on line 367
I did some research but could not identify how to solve this problem that is in the class of smtp in line 367 that I will insert here also to facilitate:
365 if (!stream_socket_enable_crypto(
366 $this->smtp_conn,
367 true,
368 $crypto_method
369 )) {
370 return false;
371 }
372 return true;
373 }
I thank you from the outset who make available to help, grateful!
Is it the same issue as that link? http://stackoverflow.com/questions/30371910/phpmailer-generates-php-warning-stream-socket-enable-crypto-peer-certificate
– Don't Panic
Checking what reported until I could understand about the code made available to put inside the file class-smtp.. but I don’t know where I can put it in there. Can you tell me?
– carloshsa
Actually it is not in the file class.smtp.php, but rather where you instantiate the class Phpmailer, example: $mail = new phpmailer(); $mail->Smtpoptions = array( ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) );
– Don't Panic
Right but in this case, I use the plugin contact form 7 wordpress. The error is coming from the class-smtp.php file and I don’t prompt the phpmailer class elsewhere.. what I would have to do?
– carloshsa
Please backup the class.phpmailer.php file, and then change on line 275
public $SMTPOptions = array()
forpublic $SMTPOptions = array('ssl'=>
 array('verify_peer'=>false, 
 'verify_peer_name' => false, 
 'allow_self_signed' => true ) 
 );
– Don't Panic
OPA! Sensational, the error has been corrected and the email is being sent! thank you very much Everson.
– carloshsa
While the @Everson solution works, keep in mind that doing this will turn off the checking of cerificates which is generally totally unsafe.
– Inkeliz