Email Type Detection

Default WordPress email system is simple and easy to work with, and there were no significant changes to email system made since early 2.0 version years ago, with only some updates to email processing and some updates to PHPMailer class (and that is currently 2 years behind the PHPMailer development). And, because of the simplicity and basically no firm rules on how mail will work, there are various methods of how different WordPress functions are using wp_mail() function.

Email Log Entry Preview
Email Log Entry Preview

That means that there is no reliable way to detect what type of email is currently sent through wp_mail() function. BuddyPress plugin has own wrapper functions around wp_mail() that include email type identifier, and that is something that WordPress can get in the future. But, for now, it is hard to determine what is sent with wp_mail().

GD Mail Queue includes a detection class that hooks into various actions and filters in WordPress and some plugins right before wp_mail() is used, and based on where the hook is executed, detect what type of email is sent through wp_mail(). And, because of that, right now plugin can detect all email types sent by WordPress, bbPress, BuddyPress, GD bbPress Toolbox Pro, GD Mail Queue and GD Topic Prefix Pro plugins, with more plugins to be included in the future. Plugin logs the email type and this type can be used in various plugin filters and actions to implement finer control over the email processing.