WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/wp mail from name

Description

The wp_mail_from_name filter modifies the "from name" used in an email sent using the wp_mail function. When used together with the 'wp_mail_from' filter, it creates a from address like "Name <email@address.com>". The filter should return a string.

Parameters

$from_name
(string) (required) The "from" name
Default: None

Examples

add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
function custom_wp_mail_from_name( $original_email_from )
{
	return 'WordPress Email System';
}

It is not necessary to call another method if you can use anonymous functions (PHP 5.3.0+):

add_filter( 'wp_mail_from_name', function($name){
	return 'WordPress Email System';
});

Change Log

Since: Version 2.3

Source Files

wp_mail_from is located in wp-includes/pluggable.php

Related