• Resolved emiubaldi

    (@emiubaldi)


    Following up on my previous thread, I was finally able to identify the real issue with my problem — which was not related to the other plugin called Elastic Email Sender as I thought but rather to Email Templates. For this reason, I would like to report an issue with the Email Templates plugin when it is used together with Elementor forms and external email gateways such as Elastic Email Sender, SMTP plugins, etc.

    📌 Summary of the Issue

    When Elementor sends HTML-formatted emails, the Email Templates plugin wraps the entire message inside a second full HTML layout.
    The result is a duplicated HTML wrapper, for example:

    <html>
    <body>
    <html>
    <body>
    ... email content ...
    </body>
    </html>
    </body>
    </html>

    This happens because Elementor already generates a complete HTML email, including:

    • <html> tag
    • <body> tag
    • full layout and CSS

    Then Email Templates applies its own template via:

    $temp_message = $this->add_template( apply_filters( 'mailtpl_email_content', $args['message'] ) );

    This leads to invalid markup, rendering issues, and compatibility problems with external email services.

    📌 How We Identified the Root Cause

    After debugging:

    • Elementor produces a full HTML email → correct
    • Email Templates wraps the message again → causes duplication
    • Elastic Email Sender simply transmits the received HTML → not the cause
    • The test email from Elastic Email works correctly → confirms duplication happens before sending
    • Disabling Email Templates fixes the issue immediately → confirms true source

    So the issue is strictly in the plugin’s email wrapping logic.

    📌 Proposed Patch (Solves the Problem for Elementor Users)

    Inside class-mailtpl-mailer.php, in the send_email() method, the plugin should detect when a message already contains a complete HTML structure and skip wrapping.

    Here is the recommended patch:

    public function send_email( $args ) {

    do_action( 'mailtpl_send_email', $args, $this );

    // Prevent double HTML wrapper for email builders like Elementor
    $has_full_html = (
    strpos($args['message'], '<html') !== false &&
    strpos($args['message'], '<body') !== false
    );

    if ( $has_full_html ) {

    // Elementor already outputs complete HTML – skip Email Templates wrapper
    $user_email = isset($args['to']) ? $args['to'] : get_option('admin_email');

    $args['message'] = $this->replace_placeholders(
    $args['message'],
    $user_email
    );

    return $args;
    }

    // Normal behavior for WP plain text emails
    $temp_message = $this->add_template(
    apply_filters( 'mailtpl_email_content', $args['message'] )
    );

    $user_email = isset($args['to']) ? $args['to'] : get_option( 'admin_email' );
    $args['message'] = $this->replace_placeholders( $temp_message, $user_email );

    return $args;
    }

    ✔ What this patch does:

    • Prevents double wrapping for Elementor and other tools that generate full HTML
    • Keeps Email Templates fully functional for WordPress system emails
    • Maintains compatibility with SMTP plugins, Elastic Email Sender, WP Mail, etc.
    • Ensures proper email rendering across clients

    This preserves 100% of the plugin’s intended functionality, while fixing the duplication issue for modern page builders and form tools.

    📌 Request

    Would you consider integrating this logic into a future release?
    It would greatly improve compatibility for Elementor users and prevent invalid email markup.

    I’d be happy to help test any version or assist further if needed.

    Thank you very much for the great work on this plugin!

    Best regards,
    Emiliano

    • This topic was modified 3 months, 4 weeks ago by emiubaldi.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for the detailed report and for identifying the source of the duplicated HTML wrapper. Your explanation and proposed patch are very helpful.

    We’ve shared this with our development team, and they will review the detection logic for fully-formed HTML emails to ensure better compatibility with Elementor and similar builders. If confirmed safe across all use cases, we’ll include an update in a future release.

    We appreciate your contribution and will post an update here once we have more news.

    Thanks & regards,
    WP Experts Support Team

    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for your suggestion and for taking the time to report the issue.

    Our team has prepared an updated build, and the problem you reported has been fixed.

    You can download the updated plugin from the link below: https://drive.google.com/file/d/1ab8JHgoIXTLb9nadwkpAoXFse0ygsRnG/view?usp=sharing

    Please test it and let us know your feedback. Once we receive your approval, we will include these fixes in the upcoming update.

    Thank you.

    Thread Starter emiubaldi

    (@emiubaldi)

    Hello @muddasirhayat,
    Thank you for sharing the updated link.

    Unfortunately, after testing, the issue is still not resolved on my end. I’ve attached the mailer I received after updating the pluign with the zip file you shared and submitting the contact form.

    Click here to view the screen capture

    Please let me know if you’d like me to run any additional tests.
    Thanks,
    Emiliano

    • This reply was modified 3 months, 3 weeks ago by emiubaldi.
    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for your update.

    We have escalated this to our development team for further review and will update you as soon as possible.

    Thank you

    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for your time.

    We discussed your case with our developer to ensure we provide a satisfactory resolution. To proceed efficiently, we would like to connect you directly with our developer.

    Kindly reach out to us through our official support portal so we can create a ticket and have the developer assist you directly. This will help us resolve the issue as quickly as possible.

    You can open a ticket by clicking here.

    For other readers: we will update this thread with the resolution once the customer’s issue has been resolved.

    Thank you for your understanding.

    Thank you

    Thread Starter emiubaldi

    (@emiubaldi)

    Thanks @muddasirhayat, I will do!

    Have a great day!

    Thread Starter emiubaldi

    (@emiubaldi)

    Hi @muddasirhayat,
    I’d like to follow up on this issue, especially after the release of the latest version, email-templates 1.5.7. As you advised three weeks ago, I opened a support ticket using the link you provided, but I never received any response. Even with the new update, the issue persists.

    As before, I’ve replaced the public function send_email( $args ) in the class-mailtpl-mailer.php file with the fixed version below.

    /**
    * Send Email to All the SMTP Plugins
    *
    * @param array $args Expected args.
    *
    * @since 1.0.0
    */
    public function send_email( $args ) {

    do_action( 'mailtpl_send_email', $args, $this );

    /* ============================================================
    PATCH — Prevent double HTML wrapper for Elementor emails
    ============================================================ */

    // Detect messages that already contain full HTML structure
    $has_full_html = (
    strpos($args['message'], '<html') !== false &&
    strpos($args['message'], '<body') !== false
    );

    if ( $has_full_html ) {

    // Elementor already generated a complete HTML email.
    // DO NOT apply Email Templates wrapper.
    // But DO apply placeholder replacement for consistency.

    $user_email = isset($args['to']) ? $args['to'] : get_option('admin_email');

    $args['message'] = $this->replace_placeholders(
    $args['message'],
    $user_email
    );

    return $args;
    }

    /* ============================================================
    NORMAL BEHAVIOR — Email Templates wraps plain WP emails
    ============================================================ */

    $temp_message = $this->add_template(
    apply_filters('mailtpl_email_content', $args['message'])
    );

    $user_email = isset($args['to']) ? $args['to'] : get_option('admin_email');

    $args['message'] = $this->replace_placeholders(
    $temp_message,
    $user_email
    );

    return $args;
    }

    Could you please follow up internally with your team and let me know the status?
    I’m also wondering why no one has replied to the ticket I submitted.

    Thank you in advance, and Happy New Year.

    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for following up.

    We did respond to the support ticket you opened on December 19, 2025. The reply was sent to the email address emiuba***@******.com. Since then, we have not received a response from your side.

    Regarding the issue you described, we have shared the details and your proposed fix with our development team. They are currently reviewing it. Once we have an update or a confirmed solution, we will inform you.

    We appreciate your patience and will get back to you as soon as possible.

    Thank you

    Thread Starter emiubaldi

    (@emiubaldi)

    Hi @muddasirhayat,
    Thank you for following up on this and for the clarification. Unfortunately, I never received your response — it likely went to my junk folder and was deleted, as I receive a large volume of emails each day and can’t always filter everything manually.

    Could you please resend your reply, or provide access to my ticket so I can review it and respond directly through the browser if possible? Otherwise, please send your reply again and let me know once it’s done so I can watch for it and make sure it doesn’t get filtered out.

    Thank you, much appreciated.

    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    Thank you for the clarification.

    We have just resent a copy of the original email to your email address. Please reply there so we can connect you directly with our development team and resolve the issue as quickly as possible.

    For other readers: We will post an update here once the customer’s issue has been resolved.

    Thank you.

    Thread Starter emiubaldi

    (@emiubaldi)

    Hello @muddasirhayat,
    I’m very sorry for the confusion. Unfortunately, I haven’t received any email from you at emiuba***@******.com — I’ve checked thoroughly, including my spam/junk folder, and there’s nothing there.

    Would you mind sending it instead to pilot29it [at] gmail [dot] com?

    Thank you very much, and sorry again for the inconvenience.

    • This reply was modified 2 months, 1 week ago by emiubaldi.
    Plugin Support muddasirhayat

    (@muddasirhayat)

    Hi @emiubaldi,

    No worries at all. We’ve resent the email to the address you provided. Please let us know if you still don’t receive it.

    Thank you

    Thread Starter emiubaldi

    (@emiubaldi)

    Hi @muddasirhayat,

    Just a quick note to confirm that the new release v1.5.9 has fully resolved the issue with the Elementor Email Wrapper on my side.

    Everything is now working as expected.

    Thanks to you and the whole team for the support and the quick fix — much appreciated 👍

    Best regards,
    Emiliano

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

You must be logged in to reply to this topic.