Make WordPress Core

Opened 3 years ago

Last modified 10 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 (3)

#1 @TimothyBlynJacobs
3 years 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
3 years 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 3 years ago by SergeyBiryukov (previous) (diff)

#3 @gavin310
10 months ago

Great idea. Being able to know the context of the call to wp_mail() would open up a lot of possibilities.

Note: See TracTickets for help on using tickets.