This page redirects to an external site: https://developer.wordpress.org/reference/hooks/wp_mail_from/
The wp_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 <[email protected]>". The filter should return an email address.
add_filter( 'wp_mail_from', 'custom_wp_mail_from' );
function custom_wp_mail_from( $original_email_address ) {
//Make sure the email is from the same domain
//as your website to avoid being marked as spam.
return '[email protected]';
}
It is not necessary to call another method if you can use anonymous functions (PHP 5.3.0+):
add_filter( 'wp_mail_from', function( $email ) {
return '[email protected]';
} );
remove_filter().Since: Version 2.2
wp_mail_from is located in wp-includes/pluggable.php