Send mail, similar to PHP’s mail

A true return value does not automatically mean that the user received the email successfully. It just only means that the method used was able to process the request without any errors.

Using the two ‘wp_mail_from’ and ‘wp_mail_from_name’ hooks allow from creating a from address like ‘Name ‘ when both are set. If just ‘wp_mail_from’ is set, then just the email address will be used with no name.

The default content type is ‘text/plain’ which does not allow using HTML. However, you can set the content type of the email by using the ‘wp_mail_content_type’ filter.

The default charset is based on the charset used on the blog. The charset can be set using the ‘wp_mail_charset’ filter.

Signature

wp_mail( $to, $subject, $message, $headers = '', $attachments = array() )
to
 (string|array) Array or comma-separated list of email addresses to send message.
subject
 (string) Email subject
message
 (string) Message contents
headers
 (string|array) Optional. Additional headers.
Default: ''
attachments
 (string|array) Optional. Files to attach.
Default: array()

Return

(boolean) Whether the email contents were sent successfully.

Source

function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
	// Compact the input, apply the filters, and extract them back out

	/**
	 * Filter the wp_mail() arguments.
	 *
	 * @since 2.2.0
	 *
	 * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
	 *                    subject, message, headers, and attachments values.
	 */
	$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

	if ( isset( $atts['to'] ) ) {
		$to = $atts['to'];
	}

	if ( isset( $atts['subject'] ) ) {
		$subject = $atts['subject'];
	}
284 more lines...
WP Trac GitHub

Link here