I am trying to understand why the "From address" on an email submission includes the name of the site even though an email address is the only thing in that field [id of email address]. If this is the default behavior, is there a way to remove that?
I just ran tests and indeed if you leave off the name, it puts in your site name automatically. I then tried the above wp_mail_from_name filter, returning the blank string and it solves the problem, at least in this test situation.
add_filter( 'wp_mail_from_name', function( $name ) {
return '';
} );
Thank you for testing and confirming. I will give this filer a try.
You can look into using these filters to manually set the From, though it'll set the From for all of your emails.
https://developer.wordpress.org/reference/hooks/wp_mail_from/
https://developer.wordpress.org/reference/hooks/wp_mail_from_name/
btw, is your host GoDaddy? GoDaddy and Formidable kind of have a hate-hate relationship when it comes to emails.
No, the host is not go daddy. Thanks for the information but setting the from address to be the same is the problem I am trying to solve. I probably wasn’t clear enough. The form value is there, but it injects the site name as well.
You can use the https://developer.wordpress.org/reference/hooks/wp_mail_from_name/ and set its name to "" although it might default back to your site name. I've honestly never run into this before.
Please login or Register to submit your answer
You you using a SMTP service in WordPress to send your email? Or the default wordpress php mailer?
Just the default