_wp_privacy_send_erasure_fulfillment_notification

The timeline below displays how wordpress function _wp_privacy_send_erasure_fulfillment_notification has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Notifies the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request($request_id);
    if (!$request instanceof WP_User_Request || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $switched_locale = switch_to_user_locale($request->user_id);
    } else {
        $switched_locale = switch_to_locale(get_locale());
    }
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters_deprecated('user_erasure_complete_email_subject', array($subject, $email_data['sitename'], $email_data), '5.8.0', 'user_erasure_fulfillment_email_subject');
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 5.8.0
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
    $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    if (!empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead.
     *                   For user request confirmation email content
     *                   use {@see 'user_request_confirmed_email_content'} instead.
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters_deprecated('user_confirmed_action_email_content', array($content, $email_data), '5.8.0', sprintf(
        /* translators: 1 & 2: Deprecation replacement options. */
        __('%1$s or %2$s'),
        'user_erasure_fulfillment_email_content',
        'user_request_confirmed_email_content'
    ));
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 5.8.0
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_erasure_fulfillment_email_content', $content, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', sanitize_url($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.4.0
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters_deprecated('user_erasure_complete_email_headers', array($headers, $subject, $content, $request_id, $email_data), '5.8.0', 'user_erasure_fulfillment_email_headers');
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.8.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($user_email, $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 6.2

/**
 * Notifies the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $switched_locale = switch_to_user_locale($request->user_id);
    } else {
        $switched_locale = switch_to_locale(get_locale());
    }
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters_deprecated('user_erasure_complete_email_subject', array($subject, $email_data['sitename'], $email_data), '5.8.0', 'user_erasure_fulfillment_email_subject');
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 5.8.0
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
    $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    if (!empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead.
     *                   For user request confirmation email content
     *                   use {@see 'user_request_confirmed_email_content'} instead.
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters_deprecated('user_confirmed_action_email_content', array($content, $email_data), '5.8.0', sprintf(
        /* translators: 1 & 2: Deprecation replacement options. */
        __('%1$s or %2$s'),
        'user_erasure_fulfillment_email_content',
        'user_request_confirmed_email_content'
    ));
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 5.8.0
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_erasure_fulfillment_email_content', $content, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', sanitize_url($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.4.0
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters_deprecated('user_erasure_complete_email_headers', array($headers, $subject, $content, $request_id, $email_data), '5.8.0', 'user_erasure_fulfillment_email_headers');
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.8.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($user_email, $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 6.1

/**
 * Notifies the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters_deprecated('user_erasure_complete_email_subject', array($subject, $email_data['sitename'], $email_data), '5.8.0', 'user_erasure_fulfillment_email_subject');
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 5.8.0
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
    $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    if (!empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead.
     *                   For user request confirmation email content
     *                   use {@see 'user_request_confirmed_email_content'} instead.
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters_deprecated('user_confirmed_action_email_content', array($content, $email_data), '5.8.0', sprintf(
        /* translators: 1 & 2: Deprecation replacement options. */
        __('%1$s or %2$s'),
        'user_erasure_fulfillment_email_content',
        'user_request_confirmed_email_content'
    ));
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 5.8.0
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_erasure_fulfillment_email_content', $content, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', sanitize_url($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.4.0
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters_deprecated('user_erasure_complete_email_headers', array($headers, $subject, $content, $request_id, $email_data), '5.8.0', 'user_erasure_fulfillment_email_headers');
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.8.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($user_email, $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 5.8

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters_deprecated('user_erasure_complete_email_subject', array($subject, $email_data['sitename'], $email_data), '5.8.0', 'user_erasure_fulfillment_email_subject');
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 5.8.0
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
    $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    if (!empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $content = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead.
     *                   For user request confirmation email content
     *                   use {@see 'user_request_confirmed_email_content'} instead.
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters_deprecated('user_confirmed_action_email_content', array($content, $email_data), '5.8.0', sprintf(
        /* translators: 1 & 2: Deprecation replacement options. */
        __('%1$s or %2$s'),
        'user_erasure_fulfillment_email_content',
        'user_request_confirmed_email_content'
    ));
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 5.8.0
     *
     * @param string $content The email content.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_erasure_fulfillment_email_content', $content, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.4.0
     * @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters_deprecated('user_erasure_complete_email_headers', array($headers, $subject, $content, $request_id, $email_data), '5.8.0', 'user_erasure_fulfillment_email_headers');
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.8.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($user_email, $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 5.4

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the data erasure fulfillment notification.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_erasure_complete_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($user_email, $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 5.3

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request_data($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site title. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 5.2

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request_data($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: Erasure request fulfilled notification email subject. %s: Site name. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 5.1

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request = wp_get_user_request_data($request_id);
    if (!is_a($request, 'WP_User_Request') || 'request-completed' !== $request->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email The email address of the notification recipient.
     * @param WP_User_Request $request    The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request->email, $request);
    $email_data = array('request' => $request, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: %s: Site name. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 9.8

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request_data = wp_get_user_request_data($request_id);
    if (!is_a($request_data, 'WP_User_Request') || 'request-completed' !== $request_data->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email   The email address of the notification recipient.
     * @param WP_User_Request $request_data The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request_data->email, $request_data);
    $email_data = array('request' => $request_data, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: %s: Site name. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: 9.6

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request_data = wp_get_user_request_data($request_id);
    if (!is_a($request_data, 'WP_User_Request') || 'request-completed' !== $request_data->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    $subject = sprintf(
        /* translators: %s Site name. */
        __('[%s] Erasure Request Fulfilled'),
        wp_specialchars_decode(get_option('blogname'), ENT_QUOTES)
    );
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email   The email address of the notification recipient.
     * @param WP_User_Request $request_data The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request_data->email, $request_data);
    $email_data = array('request' => $request_data, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => get_option('blogname'), 'siteurl' => home_url());
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', wp_specialchars_decode($email_data['sitename'], ENT_QUOTES), $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}

WordPress Version: .10

/**
 * Notify the user when their erasure request is fulfilled.
 *
 * Without this, the user would never know if their data was actually erased.
 *
 * @since 4.9.6
 *
 * @param int $request_id The privacy request post ID associated with this request.
 */
function _wp_privacy_send_erasure_fulfillment_notification($request_id)
{
    $request_data = wp_get_user_request_data($request_id);
    if (!is_a($request_data, 'WP_User_Request') || 'request-completed' !== $request_data->status) {
        return;
    }
    $already_notified = (bool) get_post_meta($request_id, '_wp_user_notified', true);
    if ($already_notified) {
        return;
    }
    /**
     * Filters the recipient of the data erasure fulfillment notification.
     *
     * @since 4.9.6
     *
     * @param string          $user_email   The email address of the notification recipient.
     * @param WP_User_Request $request_data The request that is initiating the notification.
     */
    $user_email = apply_filters('user_erasure_fulfillment_email_to', $request_data->email, $request_data);
    $email_data = array('request' => $request_data, 'message_recipient' => $user_email, 'privacy_policy_url' => get_privacy_policy_url(), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    $subject = sprintf(
        /* translators: %s: Site name. */
        __('[%s] Erasure Request Fulfilled'),
        $email_data['sitename']
    );
    /**
     * Filters the subject of the email sent when an erasure request is completed.
     *
     * @since 4.9.8
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_erasure_complete_email_subject', $subject, $email_data['sitename'], $email_data);
    if (empty($email_data['privacy_policy_url'])) {
        /* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

Regards,
All at ###SITENAME###
###SITEURL###');
    } else {
        /* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
        $email_text = __('Howdy,

Your request to erase your personal data on ###SITENAME### has been completed.

If you have any follow-up questions or concerns, please contact the site administrator.

For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###

Regards,
All at ###SITENAME###
###SITEURL###');
    }
    /**
     * Filters the body of the data erasure fulfillment notification.
     *
     * The email is sent to a user when a their data erasure request is fulfilled
     * by an administrator.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###SITENAME###           The name of the site.
     * ###PRIVACY_POLICY_URL### Privacy policy page URL.
     * ###SITEURL###            The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request            User request object.
     *     @type string          $message_recipient  The address that the email will be sent to. Defaults
     *                                               to the value of `$request->email`, but can be changed
     *                                               by the `user_erasure_fulfillment_email_to` filter.
     *     @type string          $privacy_policy_url Privacy policy URL.
     *     @type string          $sitename           The site name sending the mail.
     *     @type string          $siteurl            The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_confirmed_action_email_content', $email_text, $email_data);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $email_sent = wp_mail($user_email, $subject, $content);
    if ($email_sent) {
        update_post_meta($request_id, '_wp_user_notified', true);
    }
}