• Resolved forge12marc

    (@forge12marc)


    Hello,

    would it be possible to add the pre_wp_mail filter check before logging mail entries?

    We are using the pre_wp_mail filter in our double-opt-in plugin to block certain mails. However, these mails are still being stored in the WP Mail Logging logs even though they were skipped via pre_wp_mail.

    It would be very helpful if the logging respected the outcome of the pre_wp_mail filter to avoid unnecessary entries.

    Thank you for considering this improvement.

    Best regards,
    Marc

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Darshana

    (@darshanaw)

    Hi @forge12marc,

    Thank you for your feedback and suggestion!

    I will share this with our developers and update you once I receive more information from them.

    Thank you!

    Plugin Support Darshana

    (@darshanaw)

    Hi @forge12marc,

    Our developers have reviewed your details and provided the following information:

    Unfortunately, the WP Mail Logging plugin uses the wp_mail filter when logging emails, and this filter runs earlier than pre_wp_mail.

    However, as a workaround, you can use the wp_mail_logging_before_log_email filter to prevent certain emails from being logged. Here’s an example of how to use this filter:

    add_filter( 'wp_mail_logging_before_log_email', 'wp_mail_log_before_log_email' );
    function wp_mail_log_before_log_email( $mailArray ) {
    if ( $mailArray['to'] === '[email protected]' ) {
    return false;
    }

    return $mailArray
    }

    I hope this helps. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘pre_wp_mail Filter’ is closed to new replies.