Changing the From Name in sent emails

Hello!

I hope you are doing great.

I saw this article and wanted to do the same: https://premium.wpmudev.org/blog/wordpress-email-settings/

I want to set the name of the sender to be the title of the site.

I had this modified code, but it did not work.

function xyz_filter_wp_mail_from_name($from_name){
return wp_title();
}
add_filter("wp_mail_from_name", "xyz_filter_wp_mail_from_name");

How can I fix it?

Thank you!