• Resolved H S

    (@hsobhy)


    Hello,
    Because the form entries and layout should look exactly the same as offline paper, I use my own HTML code in Notification which contains Tables, DIVs and Headings. wpForms changes the HTML and adds TDs and TRs elements instead of just insert the entries in their places, How to prevent this and just use the notification custom HTML layout the way I do in Contact Form 7?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter H S

    (@hsobhy)

    The plugin also keep inserting breaks tags … 10 tags somewhere and 15 in other place and so on especially after <h3> tag.

    <br>

    Plugin Support Ralden Souza

    (@rsouzaam)

    Hi @hsobhy,

    Thanks for reaching out!

    When you have a chance, could you please share the custom HTML code you’re using in the Email Message field within the notification settings?

    Alternatively, you could share your form with us. We have a detailed guide on how to export your form as a JSON file here.

    This will allow us to reproduce the issue and provide further guidance.

    Thanks!

    Plugin Support Shawon Chowdhury

    (@shawon001)

    Hello @hsobhy,

    We haven’t heard back from you in a few days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation.

    Thanks!

    Thread Starter H S

    (@hsobhy)

    Hello,

    (This is something you can easily test)

    I think there is no need to share my HTML since any valid HTML with DIVs and tables (with tr. th, td ) will cause problems … even when I copy any outer HTML of a newsletter sent to my Google inbox and show perfect and use in my Notification Email it changes to completely wrong tables with borders and extra columns and/or rows as explained above

    I tried different layouts.

    Thread Starter H S

    (@hsobhy)

    Here is an example: The Code on W3 School Example

    Produce the following view (Screenshot) when send Notification Email to Gmail:
    https://ibb.co/XkNq3zQ

    Plugin Support Ralden Souza

    (@rsouzaam)

    Hi @hsobhy,

    Thanks for the details!

    When you have a moment, could you please add the code snippet below to your site:

    add_filter(
    'wpforms_emails_notifications_message',
    static function ( $message ) {

    return preg_replace_callback(
    '/<table\b[^>]*>(.*?)<\/table>/is',
    function ( $matches ) {
    return str_replace( "\r\n", '', $matches[0] );
    },
    $message
    );
    }
    );

    In case it helps, here’s our tutorial with the most common ways to add custom code like this. For the most beginner-friendly option in that tutorial, I’d recommend using the WPCode plugin.

    After adding the snippet, please test your form again and let me know if it resolves the issue.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Notification Email Custom HTML Problems’ is closed to new replies.