contact-form-7 - 电子邮件正文 img 标签上的联系表格 7 图像

标签 contact-form-7

我想创建一个带有文件/图像上传的提交表单。公司 Logo /图片等图像。通常我知道如何附加图像,作为邮件中的附件,但我希望将图像作为图像标签附加在邮件正文上,因此当我打开电子邮件时,我可以看到所有带有图像的文件然后打印它来自电子邮件。

下面的示例电子邮件

<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <th scope="row">Your Name</th>
      <td>[your-name]</td>
    </tr>
    <tr>
      <th scope="row">Your Email</th>
      <td>[your-email]</td>
    </tr>
    <tr>
      <th scope="row">Subject</th>
      <td>[your-subject]</td>
    </tr>
    <tr>
      <th scope="row">Your Message</th>
      <td>[your-message]</td>
    </tr>
    <tr>
      <th scope="row">Picture</th>
      <td><img src="[file-305]"></td>
    </tr>
  </tbody>
</table>

有没有办法在邮件正文中的图像标签上发送图像,或者它可以作为 pdf 文件完整发送?

如果有任何免费或付费插件也可以。

最佳答案

我建议您稍微修改一下电子邮件撰写程序,并将图像作为 base64 作为内联图像包含在内。

首先使用 How to convert an image to base64 encoding? 将图像转换为 base64

$path = 'path/to/uploaded-file/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);

然后使用 embedding image in html email 将其包含在您的电子邮件中
<img src="<?= $base64 ?>" />

大多数电子邮件客户应该很容易接受它。否则,您可以随时引用附件电子邮件中的内容 ID
<img src="cid:part1xxxxxxxxxx" alt="">

关于contact-form-7 - 电子邮件正文 img 标签上的联系表格 7 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54431349/

相关文章:

php - CF7 - 数据库字段验证

css - -webkit-外观 : none; not working for button

php - Echo 自定义响应消息,发送电子邮件 Hook 之前的联系表 7

php - 联系表格 7 提交验证失败

javascript - 联系表单 7 添加禁用属性到按钮以防止重复提交

php - WordPress 覆盖联系表单 mail_2 正文

php - 将所选产品变体数据传递到 Contact Form 7 查询表中

html - Contact form 7文件输入按钮设计

wordpress - 如何水平对齐 Contact Form 7 插件表单?

php - 如何通过联系表 7 获取帖子标题