Dev Resources

  • Home
  • Reference
  • BuddyX Theme
  • Functions
  • Hooks
  • Classes
Filter by type:
Search
Browse: Home / Reference / Classes / WC_Email / WC_Email::send()

WC_Email::send( string $to, string $subject, string $message, string $headers, array $attachments )

Send an email.

Contents

  • Description
    • Parameters
    • Return
    • Source
  • Related
    • Uses
  • User Contributed Notes

Description #Description


Parameters #Parameters

$to

(Required) Email to.

$subject

(Required) Email subject.

$message

(Required) Email message.

$headers

(Required) Email headers.

$attachments

(Required) Email attachments.


Top ↑

Return #Return

(bool) success


Top ↑

Source #Source

File: includes/emails/class-wc-email.php

	public function send( $to, $subject, $message, $headers, $attachments ) {
		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );

		$message              = apply_filters( 'woocommerce_mail_content', $this->style_inline( $message ) );
		$mail_callback        = apply_filters( 'woocommerce_mail_callback', 'wp_mail', $this );
		$mail_callback_params = apply_filters( 'woocommerce_mail_callback_params', array( $to, $subject, $message, $headers, $attachments ), $this );
		$return               = $mail_callback( ...$mail_callback_params );

		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );

		return $return;
	}

Expand full source code Collapse full source code


Top ↑

Related #Related

Top ↑

Uses #Uses

Uses
Uses Description
includes/emails/class-wc-email.php: WC_Email::style_inline()

Apply inline styles to dynamic content.


Top ↑

User Contributed Notes #User Contributed Notes

You must log in before being able to contribute a note or feedback.

Proudly powered by WordPress