WordPress at a glance
function is not described

wp_privacy_send_personal_data_export_email() WP 4.9.6

Send an email to the user with a link to the personal data export file

Return

true/WP_Error. True on success or WP_Error on failure.

Usage

wp_privacy_send_personal_data_export_email( $request_id );
$request_id(int) (required)
The request ID for this personal data export.

Changelog

Since 4.9.6 Introduced.

Code of wp privacy send personal data export email: wp-admin/includes/file.php WP 5.2.2

<?php
function wp_privacy_send_personal_data_export_email( $request_id ) {
	// Get the request data.
	$request = wp_get_user_request_data( $request_id );

	if ( ! $request || 'export_personal_data' !== $request->action_name ) {
		return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
	}

	// 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 );

	/** This filter is documented in wp-includes/functions.php */
	$expiration      = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
	$expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration );

	/* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
	$email_text = __(
		'Howdy,

Your request for an export of personal data has been completed. You may
download your personal data by clicking on the link below. For privacy
and security, we will automatically delete the file on ###EXPIRATION###,
so please download it before then.

###LINK###

Regards,
All at ###SITENAME###
###SITEURL###'
	);

	/**
	 * Filters the text of the email sent with a personal data export file.
	 *
	 * The following strings have a special meaning and will get replaced dynamically:
	 * ###EXPIRATION###         The date when the URL will be automatically deleted.
	 * ###LINK###               URL of the personal data export file for the user.
	 * ###SITENAME###           The name of the site.
	 * ###SITEURL###            The URL to the site.
	 *
	 * @since 4.9.6
	 *
	 * @param string $email_text     Text in the email.
	 * @param int    $request_id     The request ID for this personal data export.
	 */
	$content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id );

	$email_address   = $request->email;
	$export_file_url = get_post_meta( $request_id, '_export_file_url', true );
	$site_name       = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
	$site_url        = home_url();

	$content = str_replace( '###EXPIRATION###', $expiration_date, $content );
	$content = str_replace( '###LINK###', esc_url_raw( $export_file_url ), $content );
	$content = str_replace( '###EMAIL###', $email_address, $content );
	$content = str_replace( '###SITENAME###', $site_name, $content );
	$content = str_replace( '###SITEURL###', esc_url_raw( $site_url ), $content );

	$mail_success = wp_mail(
		$email_address,
		sprintf(
			/* translators: Personal data export notification email subject. %s: Site title */
			__( '[%s] Personal Data Export' ),
			$site_name
		),
		$content
	);

	if ( $switched_locale ) {
		restore_previous_locale();
	}

	if ( ! $mail_success ) {
		return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) );
	}

	return true;
}