Description:
- WordPress Contact Form 7;
- Mailing using smtp;
- Form Settings: "use html-format" + "mail2 use html-format" checked;
- Form Settings: Email body : just one mail-tag [calculated-template];
- Problem with paragraph tag solved (all mail-tags upon receiving are shown inside "p" html-tag);
[calculated-template] is a mail-tag dynamically filled with html, based on submitted objects handled by VueJS2 on frontend;
[calculated-template] is populated by hooking at action 'wpcf7_posted_data':
add_action('wpcf7_posted_data', array('vue_handler','handle'), 1, 1);
vue_handler::handle($data) receives $data array with some wpcf7 data which can be modified. Contents of $data array:
_wpcf7 = "1166"
_wpcf7_version = "4.9.2"
_wpcf7_locale = "ru_RU"
_wpcf7_unit_tag = "wpcf7-f1166-p1167-o1"
_wpcf7_container_post = "1167"
columns-stringified = ""
fences-stringified = ""
your-name = "name"
your-email = "email@test.com"
calculated-template = ""
Then vue_handler::handle($data) injects html into email-tag [calculated-template].
Problem: Finally [calculated-template] html-contents rendered escaped (Mailtrap.io, "HTML Source" tab):
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
</head>
<body>
<h1>Example Header</h1>
</body>
</html>
The main idea of the snippet: opening and closing html-tag symbols "<", ">" rendered escaped: "<", ">";