Closed websupporter closed 5 years ago
Good catch.
This will be fixed in the next release of the WP Mail SMTP plugin.
Thank you!
PS We have own wp_mail_smtp_providers_mailer_is_email_sent
filter, that can be used to check whether the email was successfully sent.
Thanks a lot @slaFFik.
Hi @slaFFik, just a quick reminder :)
I checked the current version 1.4.2 on wp.org and it seems, the problem is still there: https://plugins.trac.wordpress.org/browser/wp-mail-smtp/tags/1.4.2/src/Core.php#L467
@websupporter It will be released in 1.5.0 :) 1.4.2 was a compatibility (with plugins repository guidelines) release.
Just updated. wanted to leave a thx @slaFFik :heart:
wp_mail()
provides an action, you can utilize to log when mails are not send:wp_mail_failed
. So, if the PHPMailer throws an error, it will be catched bywp_mail()
and this action will be fired.In order to tell PHPMailer to throw those exceptions and not to catch them an never release them, you have to instantiate PHPMailer like this:
$phpmailer = new PHPMailer( true );
https://github.com/WordPress/WordPress/blob/931f8046d3ab430b6b355428f8d85d9ab1591d1f/wp-includes/pluggable.php#L221The
true
boolean will tellPHPMailer
to throw the errors.WP Mail SMTP extends the
PHPMailer
with its ownMailCatcher
class and replaces the default implementation here: https://github.com/awesomemotive/WP-Mail-SMTP/blob/f8aca0b8310f027985b96e7e0fc82e784202d64f/src/Core.php#L555-L560As you can see, the boolean is not set and this means it defaults to
false
. This basically disables all functionality which hooks intowp_mail_failed
.