Setting same 'From Address" in Mail Notifications for all forms

Hello

I want to set same “from address” on mail notifications of all the forms (in all the multisites)

Can anybody provide me the web hook or code to do that using functions.php?

Thank you
Regards

Hello Yves. You could use the gform_pre_send_mail filter, like this, to set the same FROM address for all forms on the site:

add_filter( 'gform_pre_send_email', 'before_email_sent', 10, 4 );
function before_email_sent( $email, $message_format, $notification, $entry ) {
    GFCommon::log_debug( __METHOD__ . '(): EMAIL BEFORE => ' . print_r( $email, true ) );
    $email['headers']['From'] = 'From: ' . 'Your Name <email@website.com>';
    GFCommon::log_debug( __METHOD__ . '(): EMAIL AFTER => ' . print_r( $email, true ) );
    return $email;
}
© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.