Plain text email notification

Is there a toggle for plain text notifications?
I need assistance implementing this.
What is currently available in help sections seems old, is it still relevant?

Hi Regina. There is no toggle/UI option. This is still relevant (PHP example #4):

If you have any questions, please let us know.

Thank you, Chris for the quick reply.
Where do I add the filter I need?
Im looking in function.php and there is nothing that references any of this:
This filter is located in form_display.php in
GFCommon::prepare_user_notification()
GFCommon::prepare_admin_notification()

Hi Regina. Do not modify any plugin files. That is PHP code which can be added to your theme functions.php file, or you can use a plugin such as this one to keep the code separate from the theme: Code Snippets – WordPress plugin | WordPress.org

This is the exact code you will add (you need to make one change):

add_filter( 'gform_notification', 'change_notification_format', 10, 3 );
function change_notification_format( $notification, $form, $entry ) {
     GFCommon::log_debug( 'gform_notification: change_notification_format() running.' );
    // Do the thing only for a notification with the name Text Notification
    if ( $notification['name'] == 'Text Notification' ) {
        GFCommon::log_debug( 'gform_notification: format changed to text.' );
        // Change notification format to text from the default html
        $notification['message_format'] = 'text';
    }
 
    return $notification;
}

In this line:
if ( $notification['name'] == 'Text Notification' ) {

You need up update “Text Notification” to whatever your notification name is. If it’s “Admin Notification” you can change it to this:

if ( $notification['name'] == 'Admin Notification' ) {

If it’s something else, you need to use that exact name from your notification here. Then this code will change the notification format from HTML to text. If you have any other questions, please let us know.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.