Test Mode for Email Notifications

Hi there,

As a developer, I usually setup forms to route to all kinds of different places based on the various email addresses provided to me by the client. But sometimes I think it would be nice to have a “test mode” that I can easily toggle on to test my form and have the notifications come only to me! That way I can catch something myself instead of the client seeing it wrong first. And without doing double work to change notifications to send to myself then changing them back to the client.

Just an idea!

I was just needing this the other day. Here’s a snippet that should work for enabling a notification test mode. You can then toggle the $intercept variable.

add_filter( 'gform_notification', function( $notification, $form, $entry ) {

	$intercept = true;

	if ( $intercept ) {
		$notification['to'] = 'email@example.com';
	}

	return $notification;

}, 10, 3 );
1 Like