MailPoet\EmailEditor\Engine

Send_Preview_Email::send_preview_email()publicWC 1.0

Sends a preview email.

Method of the class: Send_Preview_Email{}

No Hooks.

Return

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

Usage

$Send_Preview_Email = new Send_Preview_Email();
$Send_Preview_Email->send_preview_email( $data ): bool;
$data(array) (required)
The data required to send the preview email.

Send_Preview_Email::send_preview_email() code WC 9.8.1

public function send_preview_email( $data ): bool {

	if ( is_bool( $data ) ) {
		// preview mail already sent. Do not process again.
		return $data;
	}

	$this->validate_data( $data );

	$email   = $data['email'];
	$post_id = $data['postId'];

	$post    = $this->fetch_post( $post_id );
	$subject = $post->post_title;

	$email_html_content = $this->render_html( $post );

	return $this->send_email( $email, $subject, $email_html_content );
}