# Change the Sender Name and Address of WordPress Emails

> Replaces the default "WordPress " sender with your site name and, optionally, an address of your choice.

- Type: PHP
- Runs: Run everywhere
- Category: [Email](https://wpide.com/library/category/email/)
- Tags: email, sender, from
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/email-sender-name-and-address/

## Code

```php
add_filter( 'wp_mail_from', function ( $email ) {
    $custom = ''; // For example 'hello@yourdomain.com'. Leave empty to keep the current address.

    return is_email( $custom ) ? $custom : $email;
} );

add_filter( 'wp_mail_from_name', function ( $name ) {
    return 'WordPress' === $name ? wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) : $name;
} );
```

## Notes

Use an address on your own domain so messages pass SPF and DKIM checks.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Change the Sender Name and Address of WordPress Emails" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
