Skip to content

Instantly share code, notes, and snippets.

@DevinWalker
Last active February 1, 2022 14:14
Show Gist options
  • Save DevinWalker/27108de5caae623c398d2ba2acea0394 to your computer and use it in GitHub Desktop.
Save DevinWalker/27108de5caae623c398d2ba2acea0394 to your computer and use it in GitHub Desktop.
For some odd reason Gravity Forms includes quotes in the "From" sender name. This is inconsistent with other mail senders so this removes the quotes in the "From Name" email headers.
/**
* Replace Quotes in Gravity Forms Email Headers
*
* For some odd reason Gravity Forms includes quotes in the "From" sender name. This is inconsistent with other mail senders so this removes the quotes.
*
* @param $email
* @param $message_format
* @param $notification
*
* @return mixed
*/
function givewp_filter_gravityforms_quotes( $email, $message_format, $notification ) {
$email['headers']['From'] = str_replace('"', "", $email['headers']['From']);
return $email;
};
add_filter( 'gform_pre_send_email', 'givewp_filter_gravityforms_quotes', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment