【问题标题】:wpcf7 dynamic email-tag contentwpcf7 动态电子邮件标签内容
【发布时间】:2018-10-05 04:23:40
【问题描述】:

说明:

  • WordPress 联系表 7;
  • 使用 smtp 发送邮件;
  • 表单设置:勾选“使用 html-format”+“mail2 使用 html-format”;
  • 表单设置:电子邮件正文:只有一个邮件标签[计算模板];
  • 解决了段落标签的问题(接收时的所有邮件标签都显示在“p”html标签内);

[calculated-template] 是一个用 html 动态填充的邮件标签,基于 VueJS2 在前端处理的提交对象;

[calculated-template] 是通过钩子操作 'wpcf7_posted_data' 填充的:

add_action('wpcf7_posted_data', array('vue_handler','handle'), 1, 1);

vue_handler::handle($data) 接收 $data 数组,其中包含一些可以修改的 wpcf7 数据。 $data 数组的内容:

_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 = ""

然后 vue_handler::handle($data) 将 html 注入到 email-tag [calculated-template] 中。

问题: 最后 [calculated-template] html-contents 呈现转义(Mailtrap.io,“HTML Source”选项卡):

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
</head>
<body>
&lt;h1&gt;Example Header&lt;/h1&gt;
</body>
</html>

sn-p的主要思想:开闭html-tag符号“”渲染转义:“”;

【问题讨论】:

    标签: contact-form-7 html-escape


    【解决方案1】:

    已解决

    通过使用另一个钩子wpcf7_before_send_mail

    我用我的动态 html 完全替换了邮件正文。

    所有钩子列表: http://hookr.io/plugins/contact-form-7/4.5.1/hooks/#index=a

    【讨论】:

      猜你喜欢
      • 2011-03-19
      • 2021-04-02
      • 2013-03-14
      • 1970-01-01
      • 2017-09-22
      • 1970-01-01
      • 1970-01-01
      • 2015-07-22
      • 2018-03-01
      相关资源
      最近更新 更多