WordPress.org

Make WordPress Core

Opened 8 weeks ago

Last modified 8 weeks ago

#53829 new enhancement

Add unique keywords for wp_mail calls to categorize it

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

Description

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:

https://github.com/johnbillion/wp_mail

Change History (2)

#1 @TimothyBlynJacobs
8 weeks 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
8 weeks 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 8 weeks ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.