# Send Gravity Forms Notifications From Your Own Domain

> When a Gravity Forms notification uses the visitor's email or another outside domain as the From address, switches it to your domain and keeps that address as Reply-To.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: gravity-forms, deliverability, email
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/gf-from-on-own-domain/

## Code

```php
$wpide_gf_from = ''; // e.g. 'hello@yourdomain.com'; empty = wordpress@yourdomain.

add_filter( 'gform_notification', function ( $notification, $form, $entry ) use ( $wpide_gf_from ) {
    $site = preg_replace( '/^www\./', '', (string) wp_parse_url( home_url(), PHP_URL_HOST ) );
    $from = trim( GFCommon::replace_variables( (string) rgar( $notification, 'from' ), $form, $entry, false, false, false, 'text' ) );

    if ( '' === $site || ! is_email( $from ) ) {
        return $notification;
    }

    $domain = strtolower( (string) substr( strrchr( $from, '@' ), 1 ) );
    if ( $domain === $site || substr( $domain, -strlen( '.' . $site ) ) === '.' . $site ) {
        return $notification;
    }

    if ( '' === trim( (string) rgar( $notification, 'replyTo' ) ) ) {
        $notification['replyTo'] = $from;
    }
    $notification['from'] = is_email( $wpide_gf_from ) ? $wpide_gf_from : 'wordpress@' . $site;

    return $notification;
}, 20, 3 );
```

## Notes

Merge tags in the From field are resolved first; set your own sender at the top or leave it empty for wordpress@ your domain.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Send Gravity Forms Notifications From Your Own Domain" 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/
