Make WordPress Core

Opened 22 months ago

Last modified 22 months ago

#53829 new enhancement

Add unique keywords for wp_mail calls to categorize it

Reported by: birgire's profile birgire Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Mail Keywords:
Focuses: Cc:


Here's a suggestion to add unique keywords (handles) for wp_mail() calls to better categorize it, like: namespace:component/to/subject, if we simulate the block names structure, just to mention one possibility.

Examples: wp:login/user/retrieve_password or wp:login/site_admin/new_user where wp is the namespace for WordPress core and plugins could use their own.

These might also be in separate array arguments, instead of a single string.

This would help targeting a single email or group of emails.

It might be easier to implement if wp_mail() would support a single array of arguments: wp_mail( $args )

ps: Helpful list of core emails:

Change History (2)

#1 @TimothyBlynJacobs
22 months ago

I agree this would be a very helpful feature for better logging and could also provide additional utility to the existing filters in wp_mail().

#2 @birgire
22 months ago

Thanks for your feedback @TimothyBlynJacobs, yes I've been trying to find a way to categorize emails for a little email traffic plugin and found this to be missing :-)

ps: On a similar note, instead of using a pre_wp_mail hook trick to get the success/failure output of wp_mail I've also suggested an new succeeded mail action here: #53826 that might help email loggers.

Last edited 22 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.