Function

(Woo Function) Send WooCommerce Mail – wc_mail()

Pinterest LinkedIn Tumblr

Hi, Woolovers πŸ‘‹πŸΌ Today we’re going to review wc_mail() function which sends HTML emails from WooCommerce.

Details

Boring but sometimes useful staff.

TypeFunction
Full Namewc_mail()
Added–

Notes: Don’t use woocommerce_mail() since it’s @deprecated since 3.0

Parameters(5)
wc_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = '' )
  

mixed  $to          Receiver.
mixed  $subject     Subject.
mixed  $message     Message.
string $headers     Headers. (default: "Content-Type: text/html\r\n").
string $attachments Attachments. (default: "")

What does it do?

Sends HTML emails from WooCommerce

How WordPress Use?

wc-core-functions.php

/**
 * Send HTML emails from WooCommerce.
 *
 * @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 wc_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = '' ) {
	$mailer = WC()->mailer();

	return $mailer->send( $to, $subject, $message, $headers, $attachments );
}