Title: Bug Report: Double HTML Wrapper When Using Elementor Forms + Email Templates
Last modified: December 4, 2025

---

# Bug Report: Double HTML Wrapper When Using Elementor Forms + Email Templates

 *  Resolved [emiubaldi](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [6 months, 1 week ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/)
 * 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:
 *     ```wp-block-code
       <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:
 *     ```wp-block-code
       $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:
 *     ```wp-block-code
       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 6 months, 1 week ago by [emiubaldi](https://wordpress.org/support/users/emiubaldi/).

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

 *  Plugin Support [muddasirhayat](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [6 months, 1 week ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18744952)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [6 months ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18753673)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](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](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [6 months ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18754115)
 * Hello [@muddasirhayat](https://wordpress.org/support/users/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](https://app.screencast.com/Vqr7l2iLeY2b2)
 * Please let me know if you’d like me to run any additional tests.
   Thanks,Emiliano
    -  This reply was modified 6 months ago by [emiubaldi](https://wordpress.org/support/users/emiubaldi/).
 *  Plugin Support [muddasirhayat](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [5 months, 4 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18756375)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [5 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18760663)
 * 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](https://objectsws.atlassian.net/servicedesk/customer/portal/173/group/243/create/11274).
 * **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](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [5 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18762284)
 * Thanks [@muddasirhayat](https://wordpress.org/support/users/muddasirhayat/), 
   I will do!
 * Have a great day!
 *  Thread Starter [emiubaldi](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [4 months, 4 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18787203)
 * Hi [@muddasirhayat](https://wordpress.org/support/users/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.
 *     ```wp-block-code
       /**		 * 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](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18788005)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18788467)
 * Hi [@muddasirhayat](https://wordpress.org/support/users/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](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18791667)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18792684)
 * Hello [@muddasirhayat](https://wordpress.org/support/users/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 4 months, 3 weeks ago by [emiubaldi](https://wordpress.org/support/users/emiubaldi/).
 *  Plugin Support [muddasirhayat](https://wordpress.org/support/users/muddasirhayat/)
 * (@muddasirhayat)
 * [4 months, 3 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18793656)
 * Hi [@emiubaldi](https://wordpress.org/support/users/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](https://wordpress.org/support/users/emiubaldi/)
 * (@emiubaldi)
 * [4 months, 2 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18796173)
 * Hi [@muddasirhayat](https://wordpress.org/support/users/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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-report-double-html-wrapper-when-using-elementor-forms-email-templates%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/email-templates/assets/icon-256x256.gif?rev=2891165)
 * [Email Templates Customizer and Designer for WordPress and WooCommerce](https://wordpress.org/plugins/email-templates/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/email-templates/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/email-templates/)
 * [Active Topics](https://wordpress.org/support/plugin/email-templates/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/email-templates/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/email-templates/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [emiubaldi](https://wordpress.org/support/users/emiubaldi/)
 * Last activity: [4 months, 2 weeks ago](https://wordpress.org/support/topic/bug-report-double-html-wrapper-when-using-elementor-forms-email-templates/#post-18796173)
 * Status: resolved