Skip to content

Instantly share code, notes, and snippets.

@slaFFik
Last active March 18, 2025 16:48
Show Gist options
  • Save slaFFik/c1d7d4249f47da7195fb973109952090 to your computer and use it in GitHub Desktop.
Save slaFFik/c1d7d4249f47da7195fb973109952090 to your computer and use it in GitHub Desktop.
WP Mail SMTP: when using SMTP mailer - disable SSL verify on PHP 5.6+
<?php
add_filter('wp_mail_smtp_custom_options', function( $phpmailer ) {
$phpmailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
return $phpmailer;
} );
@becahp
Copy link

becahp commented Jun 20, 2022

Thank you, it works! (using Wordpress 6.0 and WP Mail SMTP Version 3.2.1)

@Lazza
Copy link

Lazza commented Oct 30, 2024

It works, thank you. For those wondering where to put this, the cleanest possible way is to use the Code Snippets plugin:

https://wordpress.org/plugins/code-snippets/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment