Automattic\WooCommerce\EmailEditor\Engine

Send_Preview_Email::send_emailpublicWC 1.0

Sends an email preview.

Method of the class: Send_Preview_Email{}

Returns

true|false. Returns true if the email was sent successfully, false otherwise.

Usage

$Send_Preview_Email = new Send_Preview_Email();
$Send_Preview_Email->send_email( $to, $subject, $body ): bool;
$to(string) (required)
The recipient email address.
$subject(string) (required)
The subject of the email.
$body(string) (required)
The body content of the email.

Send_Preview_Email::send_email() code WC 10.7.0

public function send_email( string $to, string $subject, string $body ): bool {
	do_action( 'woocommerce_email_editor_send_preview_email_before_wp_mail', $to, $subject, $body );

	add_filter( 'wp_mail_content_type', array( $this, 'set_mail_content_type' ) );

	$result = wp_mail( $to, $subject, $body );

	// Reset content-type to avoid conflicts.
	remove_filter( 'wp_mail_content_type', array( $this, 'set_mail_content_type' ) );

	do_action( 'woocommerce_email_editor_send_preview_email_after_wp_mail', $to, $subject, $body, $result );

	return $result;
}