@@ -632,112 +632,52 @@ function wp_privacy_send_personal_data_export_email( $request_id ) {
632632 'siteurl ' => $ site_url ,
633633 );
634634
635- /* translators: Personal data export notification email subject. %s: Site title. */
636- $ subject = sprintf ( __ ( '[%s] Personal Data Export ' ), $ site_name );
637-
638- /**
639- * Filters the subject of the email sent when an export request is completed.
640- *
641- * @since 5.3.0
642- *
643- * @param string $subject The email subject.
644- * @param string $sitename The name of the site.
645- * @param array $email_data {
646- * Data relating to the account action email.
647- *
648- * @type WP_User_Request $request User request object.
649- * @type int $expiration The time in seconds until the export file expires.
650- * @type string $expiration_date The localized date and time when the export file expires.
651- * @type string $message_recipient The address that the email will be sent to. Defaults
652- * to the value of `$request->email`, but can be changed
653- * by the `wp_privacy_personal_data_email_to` filter.
654- * @type string $export_file_url The export file URL.
655- * @type string $sitename The site name sending the mail.
656- * @type string $siteurl The site URL sending the mail.
657- * }
658- */
659- $ subject = apply_filters ( 'wp_privacy_personal_data_email_subject ' , $ subject , $ site_name , $ email_data );
635+ $ email_data = array (
636+ 'request ' => $ request ,
637+ 'expiration ' => $ expiration ,
638+ 'expiration_date ' => $ expiration_date ,
639+ 'export_file_url ' => $ export_file_url ,
640+ 'sitename ' => $ site_name ,
641+ 'siteurl ' => $ site_url ,
642+ );
660643
661- /* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
662- $ email_text = __ (
663- 'Howdy,
644+ WP_Mailer::register_email (
645+ 'privacy_export ' ,
646+ 'privacy ' ,
647+ array (
648+ /* translators: Personal data export notification email subject. %s: Site title. */
649+ 'subject ' => __ ( '[{{sitename}}] Personal Data Export ' ),
650+ /* translators: Do not translate {{expiration_date}}, {{export_file_url}}, {{sitename}}, {{siteurl}}: those are placeholders. */
651+ 'body ' => __ (
652+ 'Howdy,
664653
665654Your request for an export of personal data has been completed. You may
666655download your personal data by clicking on the link below. For privacy
667- and security, we will automatically delete the file on ###EXPIRATION### ,
656+ and security, we will automatically delete the file on {{expiration_date}} ,
668657so please download it before then.
669658
670- ###LINK###
659+ {{export_file_url}}
671660
672661Regards,
673- All at ###SITENAME###
674- ###SITEURL### '
662+ All at {{sitename}}
663+ {{siteurl}} '
664+ ),
665+ )
675666 );
676667
677- /**
678- * Filters the text of the email sent with a personal data export file.
679- *
680- * The following strings have a special meaning and will get replaced dynamically:
681- *
682- * - `###EXPIRATION###` The date when the URL will be automatically deleted.
683- * - `###LINK###` URL of the personal data export file for the user.
684- * - `###SITENAME###` The name of the site.
685- * - `###SITEURL###` The URL to the site.
686- *
687- * @since 4.9.6
688- * @since 5.3.0 Introduced the `$email_data` array.
689- *
690- * @param string $email_text Text in the email.
691- * @param int $request_id The request ID for this personal data export.
692- * @param array $email_data {
693- * Data relating to the account action email.
694- *
695- * @type WP_User_Request $request User request object.
696- * @type int $expiration The time in seconds until the export file expires.
697- * @type string $expiration_date The localized date and time when the export file expires.
698- * @type string $message_recipient The address that the email will be sent to. Defaults
699- * to the value of `$request->email`, but can be changed
700- * by the `wp_privacy_personal_data_email_to` filter.
701- * @type string $export_file_url The export file URL.
702- * @type string $sitename The site name sending the mail.
703- * @type string $siteurl The site URL sending the mail.
704- */
705- $ content = apply_filters ( 'wp_privacy_personal_data_email_content ' , $ email_text , $ request_id , $ email_data );
706-
707- $ content = str_replace ( '###EXPIRATION### ' , $ expiration_date , $ content );
708- $ content = str_replace ( '###LINK### ' , sanitize_url ( $ export_file_url ), $ content );
709- $ content = str_replace ( '###EMAIL### ' , $ request_email , $ content );
710- $ content = str_replace ( '###SITENAME### ' , $ site_name , $ content );
711- $ content = str_replace ( '###SITEURL### ' , sanitize_url ( $ site_url ), $ content );
712-
713668 $ headers = '' ;
714669
715- /**
716- * Filters the headers of the email sent with a personal data export file.
717- *
718- * @since 5.4.0
719- *
720- * @param string|array $headers The email headers.
721- * @param string $subject The email subject.
722- * @param string $content The email content.
723- * @param int $request_id The request ID.
724- * @param array $email_data {
725- * Data relating to the account action email.
726- *
727- * @type WP_User_Request $request User request object.
728- * @type int $expiration The time in seconds until the export file expires.
729- * @type string $expiration_date The localized date and time when the export file expires.
730- * @type string $message_recipient The address that the email will be sent to. Defaults
731- * to the value of `$request->email`, but can be changed
732- * by the `wp_privacy_personal_data_email_to` filter.
733- * @type string $export_file_url The export file URL.
734- * @type string $sitename The site name sending the mail.
735- * @type string $siteurl The site URL sending the mail.
736- * }
737- */
738- $ headers = apply_filters ( 'wp_privacy_personal_data_email_headers ' , $ headers , $ subject , $ content , $ request_id , $ email_data );
670+ /** This filter is documented in wp-admin/includes/privacy-tools.php */
671+ $ headers = apply_filters ( 'wp_privacy_personal_data_email_headers ' , $ headers , '' , '' , $ request_id , $ email_data );
739672
740- $ mail_success = wp_mail ( $ request_email , $ subject , $ content , $ headers );
673+ $ mail_success = WP_Mailer::send (
674+ 'privacy_export ' ,
675+ array (
676+ 'to ' => $ request_email ,
677+ 'headers ' => $ headers ,
678+ ),
679+ $ email_data
680+ );
741681
742682 if ( $ switched_locale ) {
743683 restore_previous_locale ();
0 commit comments