Hi @iperez_genius,
Thanks for reaching out! As I have checked with our developers, we don’t have any web hooks for the email-sending lifecycle.
Please note that we do not provide support for custom code. However, you should be able to use the following code to implement what you need.
Fires before an email is sent:
/**
* Fires before email sent *
* Allows to hook after all the preparation before the actual sending.
*
* @since 3.3.0
*
* @param MailerAbstract $mailer The Mailer object.
*/
do_action( 'wp_mail_smtp_mailcatcher_send_before', $mailer );
Fires after an email is sent:
/**
* Fires after email sent *
* Allow to perform any actions with the data.
*
* @since 3.5.0
*
* @param MailerAbstract $mailer The Mailer object.
* @param MailCatcherInterface $mailcatcher The MailCatcher object.
*/
do_action( 'wp_mail_smtp_mailcatcher_send_after', $mailer, $this );
I hope this helps. Thanks!
-
This reply was modified 2 years, 3 months ago by
Darshana.
Thanks for your reply. In your after event what does “$this” refer too.
Darshana, are you certain about the second hook.
The first one works fine, however the second one doesn’t fire.
Hi @iperez_genius,
Based on the details provided by our developers, I can provide the following information.
$this refers to $phpmailer object.
Our developers have tested the second function and have confirmed that it is working as expected.
add_action( 'wp_mail_smtp_mailcatcher_send_after', function ( $mailer, $mailcatcher ) {
// Do something.
} );
Thanks!