Post Pic

How to change WordPress default FROM email address

WordPress is a very flexible blogging platform, but by default, you can’t modify the FROM email adress. If you want to be able to easily change it, just read the recipe I have for you today.

Simply paste the following snippet into your functions.php file. Don't forget to put the desired email adress on line 5 and desired name on line 8.

add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');

function new_mail_from($old) {
 return 'admin@yourdomain.com';
}
function new_mail_from_name($old) {
 return 'Your Blog Name';
}

Credits: Rainy Day Media.

6 Responses

Nov 30 2011 05:14

u know, the wordpress would send you email when there are new comments on your blog, do u know how to change the format of the email content? not only the email address

May 25 2012 22:15

This works great…. except when I receive the email and hit ‘reply’ it sends to the admin email and not the one I put in function:
function new_mail_from($old) {
return ‘admin@yourdomain.com’;
}
I think it is because it only changes the From: and not the Reply-To: headers in the email. I am guessing there is not hook filter for Reply-To since that may open up spoofing and spamming stuff??

Jan 31 2013 20:26

As an alternative to this method, I recommend the SB Welcome Email Editor – http://wordpress.org/extend/plugins/welcome-email-editor/

The Reasons:

The plugin does not automatically change the email address for ALL other plugins.

For example – If you use Contact Form 7 (http://wordpress.org/extend/plugins/contact-form-7/) or another contact form plugin, the method above will change all “From” fields set in the contact form settings to the default email address and name set in the functions.php and ignore the email address and from name set in the contact form.

Feb 27 2013 20:50

Ok… so functions.php. uh… where would that be located? I don’t see it in my wp file structure.

Mar 30 2013 08:31

@sylvia, functions.php is located in your theme directory something like this ../wp-content/themes/nameOfYourTheme/functions.php

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox