Automattic\WooCommerce\Admin\API

MobileAppQRLogin::send_sign_in_notification_emailprivateWC 1.0

Render and dispatch the sign-in notification email.

Uses wp_mail() with our own minimal HTML shell rather than WC()->mailer()->wrap_message() — the WC wrapper auto-prepends a small site-name header that duplicates the subject line shown by most clients and constrains the body width. Owning the wrapper lets us deliver one coherent layout.

Method of the class: MobileAppQRLogin{}

No Hooks.

Returns

bool. True if WordPress accepted the message for delivery.

Usage

// private - for code of main (parent) class only
$result = $this->send_sign_in_notification_email( $user, $consumed_record ): bool;
$user(WP_User) (required)
Recipient.
$consumed_record(array<string, mixed>) (required)
The consumed record (same shape as maybe_send_sign_in_notification_email).

MobileAppQRLogin::send_sign_in_notification_email() code WC 11.0.1

private function send_sign_in_notification_email( \WP_User $user, array $consumed_record ): bool {
	$site_name = wp_specialchars_decode(
		(string) get_bloginfo( 'name' ),
		ENT_QUOTES
	);

	/* translators: %s: site name. */
	$subject = sprintf( __( 'A new device signed in to %s', 'woocommerce' ), $site_name );

	$body_html = $this->render_sign_in_notification_email_body( $user, $consumed_record, $site_name, $subject );

	return wp_mail(
		$user->user_email,
		$subject,
		$body_html,
		array( 'Content-Type: text/html; charset=UTF-8' )
	);
}