MailPoet\EmailEditor\Engine

Send_Preview_Email::send_email()publicWC 1.0

Sends an email preview.

Method of the class: Send_Preview_Email{}

No Hooks.

Return

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 9.8.1

public function send_email( string $to, string $subject, string $body ): bool {
	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' ) );

	return $result;
}