Send_Preview_Email
in package
Class Send_Preview_Email
This class is responsible for handling the functionality to send preview emails. It is part of the email editor integrations utilities.
Table of Contents
- $personalizer : Personalizer
- Instance of the Personalizer class used for rendering personalization tags.
- $renderer : Renderer
- Instance of the Renderer class used for rendering the editor emails.
- __construct() : mixed
- Send_Preview_Email constructor.
- render_html() : string
- Renders the HTML content of the post
- send_email() : bool
- Sends an email preview.
- send_preview_email() : bool
- Sends a preview email.
- set_mail_content_type() : string
- Sets the mail content type. Used by $this->send_email.
- set_personalize_content() : string
- Personalize the content.
- fetch_post() : WP_Post
- Fetches a post_id post object based on the provided post ID.
- validate_data() : void
- Validates the provided data array.
Properties
$personalizer
Instance of the Personalizer class used for rendering personalization tags.
private
Personalizer
$personalizer
$renderer
Instance of the Renderer class used for rendering the editor emails.
private
Renderer
$renderer
Methods
__construct()
Send_Preview_Email constructor.
public
__construct(Renderer $renderer, Personalizer $personalizer) : mixed
Parameters
- $renderer : Renderer
-
renderer instance.
- $personalizer : Personalizer
-
personalizer instance.
Return values
mixed —render_html()
Renders the HTML content of the post
public
render_html(WP_Post $post) : string
Parameters
- $post : WP_Post
-
The WordPress post object.
Return values
string —send_email()
Sends an email preview.
public
send_email(string $to, string $subject, string $body) : bool
Parameters
- $to : string
-
The recipient email address.
- $subject : string
-
The subject of the email.
- $body : string
-
The body content of the email.
Return values
bool — Returns true if the email was sent successfully, false otherwise.send_preview_email()
Sends a preview email.
public
send_preview_email(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
-
The data required to send the preview email.
Tags
Return values
bool — Returns true if the preview email was sent successfully, false otherwise.set_mail_content_type()
Sets the mail content type. Used by $this->send_email.
public
set_mail_content_type(string $content_type) : string
Parameters
- $content_type : string
-
The content type to be set for the mail.
Return values
string — The content type that was set.set_personalize_content()
Personalize the content.
public
set_personalize_content(string $content) : string
Parameters
- $content : string
-
HTML content.
Return values
string —fetch_post()
Fetches a post_id post object based on the provided post ID.
private
fetch_post(int $post_id) : WP_Post
Parameters
- $post_id : int
-
The ID of the post to fetch.
Tags
Return values
WP_Post — The WordPress post object.validate_data()
Validates the provided data array.
private
validate_data(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
The data array to be validated.