string $from_email )
Filters the email address to send from.
Email address to send from.
wp_mail_fromfilter 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.
- To avoid your email being marked as spam, it is highly recommended that your “from” domain match your website.
- Some hosts may require that your “from” address be a legitimate address.
- If you apply your filter using an anonymous function, you cannot remove it using remove_filter() .
View all references
$from_email = apply_filters( 'wp_mail_from', $from_email );
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.