public function sendEmail($post) { $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); $subject = apply_filters('woocommerce_email_subject_gift_card', sprintf('[%s] %s', $blogname, __('Gift Card Information', 'rpgiftcards')), $post->post_title); $sendEmail = get_bloginfo('admin_email'); $headers = array('Content-Type: text/html; charset=UTF-8'); ob_start(); $mailer = WC()->mailer(); $email = new WPR_Giftcard_Email(); echo '<style >'; wc_get_template('emails/email-styles.php'); echo '</style>'; $email_heading = __('New gift card from ', 'rpgiftcards') . $blogname; $email_heading = apply_filters('rpgc_emailSubject', $email_heading); $toEmail = wpr_get_giftcard_to_email($post->ID); $theMessage = $email->sendGiftcardEmail($post->ID); $theMessage = apply_filters('rpgc_emailContents', $theMessage); echo $mailer->wrap_message($email_heading, $theMessage); $message = ob_get_clean(); $attachment = ''; $email = new WC_Email(); $email->send($toEmail, $subject, $message, $headers, $attachment); }
/** * Send the email. * * @param mixed $to * @param mixed $subject * @param mixed $message * @param string $headers (default: "Content-Type: text/html\r\n") * @param string $attachments (default: "") * @return bool */ public function send($to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "") { // Send $email = new WC_Email(); return $email->send($to, $subject, $message, $headers, $attachments); }