add_filter('wp_mail_from', function($email){
return str_replace('wordpress@', 'webmaster@', $email );
});
add_filter('wp_mail_from_name', function($name){
return $name === 'WordPress' ? get_bloginfo('name') : $name;
});
Here’s a version that uses the admin email set in in wordpress settings. This isn’t a great idea if the admin email isn’t a domain you own and can add the sending IP to the domain’s SPF record.
add_filter('wp_mail_from', function($email){
if( substr($email,0,10) === 'wordpress@')
$email = get_option('admin_email');
return $email;
});
I’ve seen someething weird happen when the blog name had an apostrophe, so I did this dumb workaround:
add_filter('wp_mail_from_name', function($name){
if($name === 'WordPress')
$name = str_replace( '’', "'", get_option('blogname') );
return $name;
});