How to Change wp_mail_from in WordPress

Snippets by IsItWP

Are you looking for a way to change the from address in your WordPress theme? While there’s probably a plugin for this, we have created a quick code snippet that you can use to change wp_mail_from in WordPress.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

    function from_mail($content_type) {
        return '[email protected]';

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 24 best WordPress education themes and how to create stunning WordPress optin forms.

Comments   Leave a Reply

  1. How to delete an address of the sender into email wordpress

  2. Too late for John, but if anyone comes across this again, to change the name the mail comes from, the filter is wp_mail_from_name. So something like:

    function from_mail_name($content_type) {
    return ‘My Business Name’;

  3. Clever, thanks.
    But the name of the email is still WordPress, any idea how to change that as well?
    function mail-name or something …

  4. Tweets that mention Wordpress Change wp_mail_from wordpress – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com February 14, 2011 at 12:54 am

    […] This post was mentioned on Twitter by HTMLfrp, WPSNIPP. WPSNIPP said: #wordpress Change wp_mail_from wordpress http://bit.ly/gBG5VY #blog please RT 🙂 […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!