Filters the email address to send from.
Parameters
$from_emailstring- Email address to send from.
Source
$from_email = apply_filters( 'wp_mail_from', $from_email );
Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
| CARVIEW |
Filters the email address to send from.
$from_emailstringwp_mail_from filter modifies the “from email address” used in an email sent using the wp_mail() function. When used together with the ‘wp_mail_from_name‘ filter, it creates a from address like “Name”. The filter should return an email address.$from_email = apply_filters( 'wp_mail_from', $from_email );
| Used by | Description |
|---|---|
wp_mail()wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
The default “from” value is wordpress@thesitedomainname. Where thesitedomainname is the domain name of your web site (e.g. xxxyyyzz.com).
Examples migrated from Codex:
Using anonymous functions (PHP 5.3.0+) for callback:
Example of how to use this filter to update the user portion of the email address to send from.
Simple way to filter the email address using str_replace() function.