Change the title and email id of emails sent by wordpress automatically

Here again a better easy answer.

Mostly when setup WordPress for multi user registration, you will rarely notice that title and email address of mail sent by backed is something like title:  WordPress and sent by wordpress@example.com

But here i have a very easy way to change them with the name and email id of admin user automatically . Whenever you change admin email it up going emails will be sent by new email id set in admin profile.

So the magical code is as below:


/* admin */
function wpc_fromemail($email) {
$wpfrom = get_option( 'admin_email' );
return $wpfrom;
}

function wpc_fromname($email){
$wpfrom = get_option( 'blogname' );
return $wpfrom;
}

add_filter('wp_mail_from', 'wpc_fromemail');
add_filter('wp_mail_from_name', 'wpc_fromname');

I have +4 years of quality experience in Front-End Developer from India. I have worked on HTML5, CSS3, JSON, XML, Angular, jQuery, WordPress, Bootstrap for developing tabled, table-less, responsive and non-Responsive web-sites. I have worked on many complicated and easy design in some top level web development companies in India while also working on independent projects as freelancer.

Got something to say? Go for it!