wp_mail filter-hookWP 2.2.0

Filters the wp_mail() arguments.

Usage

add_filter( 'wp_mail', 'wp_kama_mail_filter' );

/**
 * Function for `wp_mail` filter-hook.
 * 
 * @param array $args Array of the `wp_mail()` arguments.
 *
 * @return array
 */
function wp_kama_mail_filter( $args ){

	// filter...
	return $args;
}
$args(array)

Array of the wp_mail() arguments.

  • to(string|string[])
    Array or comma-separated list of email addresses to send message.

  • subject(string)
    Email subject.

  • message(string)
    Message contents.

  • headers(string|string[])
    Additional headers.

  • attachments(string|string[])
    Paths to files to attach.

Changelog

Since 2.2.0 Introduced.

Where the hook is called

wp_mail()
wp_mail
wp-includes/pluggable.php 192
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );

Where the hook is used in WordPress

wp-includes/default-filters.php 264
add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );