Custom "To:" Name for Notification Emails

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

1 Like

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

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 filter. Here is the code I added:

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" <>';
                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:

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.

Try like this:

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;