I am trying to:
Send Toolset Forms notifications styled with beefree (basically just a cross-client compatible HTML styled email)
I expected to see:
Actually styled emails
Instead, I got:
Tons of
tags added
If using
to wrap whole email, tons of
tags added where html has line breaks
If minified and using
, still adding
tags in the send email for example like
becomes
(without ever an opening p tag, and anyway, it should not inject random things)
In summary: you cannot send proper client compatible emails.
Hello,
Welcome to Toolset support. We certainly will not be able to support all email clients, but I will be happy to check how you set the notification to test.
I created a clean installation of Toolset, and you can enter the admin here:
hidden link
I created a form, and you can add a notification there:
hidden link
Please add the simplest notification code that you can, which will show the issue, and I will test it on various email clients.
Thanks.
I have added a notification to said form - in the unminified and unconcatenated version.
You can ask GPT to prep if for Toolset forms because it is the only tool wide and far that was able to concatenate and minify it in a way without breaking it - however, you will see that it still adds those unexpected tags, thus breaking rendering on the client side.
You do not necessarily need to send yourself an email - you can just use a mail logger WP side and look at the HTML preview for example.
Note, Toolset Forms does not (and cannot) "support all mail clients". This is why we have a notification HTML editor were we can add support for it.
Also note, this issue has been reported in past but all tickets I found have been deleted, see for example:
https://toolset.com/forums/topic/rogue-paragraphs-being-inserted-into-toolset-form/
I thought I even had reported this myself once but couldn't find the ticket anymore, so probably I imagined it.
Hello and thank you for the code.
I asked the second tier support to take a look and I will get back to you as soon as I have an update.
Thanks.
Hello,
The issue is escalated to the development team. The issue is that the shortcode (wpautop) is applied to the whole message, including the body, instead of the inner HTML.
Please add the code below to either your theme functions.php or use the Toolset custom code section from settings:
remove_filter( 'toolset_the_content_basic_formatting', 'wpautop', 10 );
That should fix the issue. The scope for this filter removal is global. You might need to apply it per case if you need.
After you apply the fix please use the RAW button to avoid haing P tags and the BR tags will not be added to the message.
Thanks.
This does seem to resolve the issue.
I hooked it to CRED with
add_action( 'cred_submit_complete', 'my_toolset_disable_autop_for_notifications', 10, 2 );
function my_toolset_disable_autop_for_notifications( $post_id, $form_data ) {
// Optional: limit to a specific form ID
// if ( (int) $form_data['id'] !== 123 ) {
// return;
// }
// Disable auto paragraphs in Toolset's basic formatting for this request
remove_filter( 'toolset_the_content_basic_formatting', 'wpautop', 10 );
}
Any better ideas?
In any case do you mind to keep this open as escalated afterwards?
Thanks!
Hello,
Thank you. Yes I will set the ticket as escalated.
Thanks.