首页 > 解决方案 > 使用href在php中发送邮件

问题描述

这是消息内容

    <?php

    $message = "
    <html><body>
    <table border='1' width='100%' >
    <thead>
    <tr>
        <th scope='col'>Product Name</th>
        <th scope='col'>Quantity</th>
        <th scope='col'>Total Price (RM)</th>
    </tr>
    </thead>
    ";

     ?>

信息作为表格

<a href="mailto:<?php echo $Display["SupplierEmail"]; ?>?subject=Buy a Product&cc=<?php echo $AdminEmail; ?>&body=<?php echo $message; ?>">Send me an email</a>

输出变为 打开电子邮件示例

图片中的问题 [1]:https://i.stack.imgur.com/yrhVX.png

如何解决?

标签: phpemailhref

解决方案


大多数电子邮件程序不会让您嵌入 html,但我知道它的格式不是很好,但是如何创建一个 from,用默认数据填充它?

<form action="mailto:postmaster@mydomain.com" method="post" enctype="text/plain">
   <input type="text" name="productname" id="productname" value="answer" />
   <input type="text" name="quantity" id="quantity" value="42" />
   <input type="text" name="price" id="price" value="everything" />
   <input type="submit" name="submit" value="Send" />
</form>

您可以根据需要隐藏表单字段,并且可以使用制表符和空格进行格式化


推荐阅读