Created
August 26, 2022 22:18
-
-
Save bacoords/ad33e19e5973aa016d5c65bacb0ca96f to your computer and use it in GitHub Desktop.
Since wc_mail doesn't seem to work perfectly, a custom version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Our custom alternative to wc_mail. | |
* | |
* @param mixed $to Receiver. | |
* @param mixed $subject Subject. | |
* @param mixed $message Message. | |
* @param string $headers Headers. (default: "Content-Type: text/html\r\n"). | |
* @param string $attachments Attachments. (default: ""). | |
* @return bool | |
*/ | |
function prefix_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) { | |
if( ! class_exists( 'WC_Emails' ) ) { include_once WC_ABSPATH . 'includes/class-wc-emails.php'; } | |
$mailer = WC()->mailer(); | |
$message = $mailer->wrap_message( $subject, $message ); | |
return $mailer->send( $to, $subject, $message, $headers, $attachments ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment