[wp-trac] [WordPress Trac] #49661: mails, Howdy, wp_mail() and filters spreading

WordPress Trac noreply at wordpress.org
Tue Mar 17 17:55:11 UTC 2020


#49661: mails, Howdy, wp_mail() and filters spreading
-----------------------------+-----------------------------
 Reporter:  arena            |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Mail             |    Version:  trunk
 Severity:  normal           |   Keywords:  has-patch
  Focuses:                   |
-----------------------------+-----------------------------
 Hello,

 The different mails that are build to be sent with function wp_mail() have
 different ways of doing it. Some are using str_replace(), others are using
 sprintf(), have a different vocabulary (SITENAME, SITE_NAME,
 ###SITENAME### ...)

 Last but not least, some have different filters : from No filters to
 subject and/or content and/or mail headers and here again with different
 vocabularies ( filter_prefix_content or filter_prefix_message) ...

 So when you want to change some mails that belong to a group of mails
 (admin, network, privacy ..), you have to dig in the code and eventually
 ask for specific changes for this or that mail.

 With privacy, and locally for legal purpose, related mails must be sent by
 a new profile in the organisation, by some sort of a new WP "role" that is
 still to be created : the cop ... for Chief Of Privacy . In Europe, we
 call him a dpo.

 The following patch proposes to have all mails equals (except some
 specific ones related to wp updates).

 Subject and Mail body are templates.
 The {{Mustache}} standard is adopted.
 All mails have an id and belong to a group.

 This is an encapsulation of wp_mail() with some conventions to get the
 best results.

 With the patch, i attach here
 * a zip file that is a set of .eml files (with some logging in it for
 debugging purpose)

 As a proof of concept, i also attach the three plugins i developped
 * logphpmailer.php : to save eml files
 * wp_mailer_filter.php : sample plugin filtering mail using the new
 filters of wp_mailer class (here for privacy mails)
 * wp_mailer_logger.php : appends some logging to mail content using the
 new filters of wp_mailer class

 the patch also fixes a bug i detected on the Reply-To mail header (double
 quotes doubled, added by wp AND phpmailer)

 I know this is a big one. Due to CoVid, i am stuck at home in front of my
 keyboard.

 Regards

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49661>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list