Using WordPress meta field values for dynamic Gravity Form emails

Ever use Gravity Forms and want to easily add a form that takes an email value from the post? For example maybe you have store profile posts and each post has a contact form in the sidebar, but you want the email sent to each individual  person/store/whatever. Well there is a really simple way to do that.

function your_custom_notification_signature( $notification, $form) {

   //This example is using a form with the id of 1
    if($form["id"] == 1){
        global $post;

        //the example email is stored in a post meta field called "_cmb_email"
        $store_email = get_post_meta( $post->ID , '_cmb_email', true );
        $notification['to'] = $store_email;

       return $notification;
    }
}

add_filter('gform_notification', 'your_custom_notification_signature', 10, 3);

You can change a lot more than that as well, have a look at: