Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
} );
@myselfhimself

This comment has been minimized.

Copy link

myselfhimself commented Jan 30, 2018

Thank you for pasting! To be used with this plugin: https://wordpress.org/plugins/wp-mail-smtp/

@harisrozak

This comment has been minimized.

Copy link

harisrozak commented Jan 9, 2020

Thank you!, I was stuck on "error sending email" before applying this code

@SimonFricker

This comment has been minimized.

Copy link

SimonFricker commented Apr 17, 2020

Not working anymore

@rklabal

This comment has been minimized.

Copy link

rklabal commented May 22, 2020

Still working, thanks a lot.

@Whateverinc

This comment has been minimized.

Copy link

Whateverinc commented Jun 17, 2020

I don't think this is secure.

@slaFFik

This comment has been minimized.

Copy link
Owner Author

slaFFik commented Jun 17, 2020

@Whateverinc Its definitely not secure. And users should fix there server setup to use a proper certificate.

@harisrozak

This comment has been minimized.

Copy link

harisrozak commented Jun 17, 2020

@slaFFik in my case, the client has been used this "unsecured" email server for a long time, and they don't even mind that issue as long as it works, and as a new developer for a new app, I must adapt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.