# Custom "To:" Name for Notification Emails

**URL:** <https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211>\
**Category:** Feature Requests\
**Tags:** notifications, roc-2493\
**Created:** [November 8, 2019, 7:49pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211 "2019-11-08T19:49:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lonepc](https://avatars.discourse-cdn.com/v4/letter/l/3ec8ea/32.png) [@lonepc](https://community.gravityforms.com/u/lonepc)\
**Post date:** [November 8, 2019, 7:49pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/1 "2019-11-08T19:49:02Z")

</div>

The GUI should allow a custom “To:” Name for notification emails.

---

<div class="post-metadata">

**Author:** ![lonepc](https://avatars.discourse-cdn.com/v4/letter/l/3ec8ea/32.png) [@lonepc](https://community.gravityforms.com/u/lonepc)\
**Post date:** [December 9, 2019, 6:53pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/2 "2019-12-09T18:53:51Z")

</div>

Following up. Not having a “To:” name makes emails generated by Gravity Forms look very unprofessional before the user has even opened the email.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 20, 2019, 9:51pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/3 "2019-12-20T21:51:08Z")

</div>

Point taken about having this option be in the UI. I opened a feature request for this issue.

It is possible to accomplish right now, using the [gform\_pre\_send\_email](https://docs.gravityforms.com/gform_pre_send_email/) filter. Here is the code I added:

```auto
add_filter( 'gform_pre_send_email', 'before_email_3211', 10, 4 );
function before_email_3211( $email, $message_format, $notification, $entry ) {
        // apply only to submissions for form 366
        // you can check by notification name as well if you needed to
        if ( rgar ( $entry, 'form_id' ) == 366 ) {
                GFCommon::log_debug( __METHOD__. '(): Original email => ' . print_r( $email, true ) );
                // you can set this dynamically based on values submitted in the form, using the $entry
                // I just set it statically to test the format
                $email['to'] = '"Chris Hajii Gomeshi" <chrishajer+3211@gmail.com>';
                GFCommon::log_debug( __METHOD__. '(): Modified email => ' . print_r( $email, true ) );
                return $email;
        }
}

```

That mail was delivered - here is a screenshot of the delivery information from my Gmail client:

> **[Screenshot at December 20th 2019 - 3.40.03 pm.png](https://d.pr/i/nDuGal)**
>
> Shared with Droplr

---

<div class="post-metadata">

**Author:** ![lonepc](https://avatars.discourse-cdn.com/v4/letter/l/3ec8ea/32.png) [@lonepc](https://community.gravityforms.com/u/lonepc)\
**Post date:** [January 16, 2020, 4:48am UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/4 "2020-01-16T04:48:19Z")

</div>

> [@chrishajer](#):
>
> It is possible to accomplish right now, using the [gform\_pre\_send\_email](https://docs.gravityforms.com/gform_pre_send_email/) filter.

How would I modify your code in order to target a specific notification and use a Name Field from the form + the original email address? I know your comments indicate that this is possible, but I’m not sure exactly how to adjust your example.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [January 16, 2020, 6:58pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/5 "2020-01-16T18:58:33Z")

</div>

Try like this:

```auto
add_filter( 'gform_pre_send_email', 'before_email_3211', 10, 4 );
function before_email_3211( $email, $message_format, $notification, $entry ) {
	// apply to one specific notification by name
	// change the name to your own unique notification name
	if ( $notification['name'] == 'Admin Notification 3211' ) {
		// grab the first and last name from the entry, field 1 in my form; update to your field ID
		$first_name = rgar ( $entry, '1.3' );
		$last_name = rgar ( $entry, '1.6' );
		// uses the name from the form and the original $email['to']
		$email['to'] = "\"{$first_name} {$last_name}\" <{$email['to']}>";
		return $email;
	}
}

```

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [July 29, 2021, 1:58pm UTC](https://community.gravityforms.com/t/custom-to-name-for-notification-emails/3211/6 "2021-07-29T13:58:21Z")

</div>


