wp_mail is the mail function of WordPress and it works fine. The point is it will always show wordpress@yourblogname.domain as the sender. This, certainly for companies, is not very professional. So how to change this “from” address in the wp_mail function?
Simple, overwrite the function with a filter. You can use the code below to let wp_mail use your blog name and your administrator e-mail address instead of WordPress and wordpress@yourblogname.domain.
Just put the following code in your functions.php file to let this work.
add_filter( ‘wp_mail_from’, ‘fmm_mail_from’ );
function fmm_mail_from( $email ) {
$blog_mail = get_bloginfo(‘admin_email’);
return $blog_mail;
}
add_filter( ‘wp_mail_from_name’, ‘fmm_mail_from_name’ );
function fmm_mail_from_name( $name ) {
$blog_title = get_bloginfo();
return $blog_title;
}