get_template(); if ( file_exists( $template ) ) { ob_start(); // Start output buffering include $template; $body = ob_get_clean(); // Retrieve and clean output buffer echo wp_kses_post( $body ); // Output the email body } } /** * Add email footer * * @return void */ public function add_email_footer() { include TIMETICS_PLUGIN_DIR . '/templates/emails/email-footer.php'; } /** * Get email content * * @return string */ public function get_template_content() { ob_start(); $this->add_email_body(); $template = ob_get_clean(); return $template; } /** * Send email using email template * * @return bool */ public function send() { $headers = $this->get_headers(); $subject = $this->get_subject(); $to = $this->get_recipient(); $message = $this->get_template_content(); /** * Added temporary for leagacy sass. It will remove in future. */ $data = apply_filters( 'timetics/admin/email/send', [$to, $subject, $message, $headers] ); return wp_mail( ...$data ); } }