I'm trying to log the purchase receipt email sent out by the EDD plugin, in the database. But I'm unable to do so.
The custom plugin that logs emails is hooked on to
wp_loaded hook and filters all emails by the following filter.
add_filter( 'wp_mail', array( $this, 'log_email' ) );
But the purchase receipt emails are not logged.
Note: The custom plugin logs others emails sent. Example, if I use WP Mail SMTP plugin to send a test email, the email is perfectly logged into database.
I debugged to see if my hook is invoked at a later point, but I found that EDD sends the purchase receipts emails via
I further debugged and found that my plugin is not hooked into global $wp_filter var.
var_dump( $wp_filter['wp_mail'] );
Reference: WordPress Action hook sequence
Any suggestion is greatly appreciated.