Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Corrigindo Quebras de Linha Ausentes em E-mails de Notificação

In some cases, WPForms notification emails may lose line breaks and display as a single paragraph in certain email clients. This can happen when you use a custom message in the notification email and add new lines by pressing Return.

In this tutorial, we’ll show you two ways to handle the issue. Use these options only if you’re already seeing the formatting problem on your site.

Important: These options are not recommended as a “just in case” change. Only apply them if your notification emails are currently removing line breaks.

The simplest and most reliable approach is to add HTML line breaks in your notification message.

In the WPForms form builder, open the form you want to edit and go to Settings » Notifications. Under the notification you’re using, find the Email Message field. Wherever you want the email to start a new line, type <br/> directly into the message.

For example, you can write Hi there,<br/>Thanks for reaching out!<br/>We’ll get back to you soon.

Option 2: Convert Line Breaks Automatically With a Snippet

If you prefer to keep writing your notification message using normal line breaks, you can use the snippet below to convert new lines into <br/> before the email is sent.

Add this snippet to your site:

If you need help adding custom code snippets, please review this tutorial on adding custom code to your site.

add_filter( 'wpforms_emails_notifications_processed_message', function ( $processed_message, $message, $notification ) {

	return make_clickable( nl2br( $message ) );
}, 10, 3 );

Target a Specific Form

If the issue is only happening for one form, you can limit the snippet to a specific form ID:

add_filter( 'wpforms_emails_notifications_processed_message', function ( $processed_message, $message, $notification ) {

	if ( $notification->form_data['id'] === 'FORM ID' ) {
		return make_clickable( nl2br( $message ) );
	}

	return $processed_message;
}, 10, 3 );

Remember to replace FORM ID with the ID of the form you want to target.

That’s all you need. After adding the snippet, your notification emails should preserve line breaks instead of displaying as one long paragraph.

Next, you may want to review our guide on creating multi page forms in WPForms to see all the options for configuring page breaks and progress indicators