php - 使用php将pdf附件发送到mysql数据库中的电子邮件

标签 php mysql pdf-generation email-attachments

代码:

   <?php
   $servername = "localhost";
    $username = "username";
   $password = "****";
   // Create connection
   $conn = new mysqli($servername, $username, $password);
   // Check connection
     if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
    }
$sql = "SELECT email, name FROM MyGuests";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {

$conn->close();

    ?>


<table width="348" border="0">
 <tr>
   <td width="88">Name</td>
<td width="98">Email</td>
<td width="148">Select All

    <label>
      <input type="checkbox" name="checkbox" id="checkbox">
    </label>    </td>
 </tr>
 <tr>
<?php {?><td><?php echo $row["name"];?>
    }
</td>
<td><?php echo $row["email"];?></td>
<td><label>
  <input type="checkbox" name="checkbox" id="checkbox">
</label></td><?php } else {
echo "0 results";
}?>
  </tr>
  <tr>
 <td>&nbsp;</td>
 <td>&nbsp;</td>
 <td><label>
  <input type="submit" name="button" id="button" value="Send">
 </label></td>
    </tr>
 </table>

我想将附有 pdf 文件的电子邮件发送给表中列出的电子邮件用户。我在名为“slips”的文件夹中有一个生成的pdf文件,其中以电子邮件作为文件名,例如每个文件名都带有数据库中电子邮件的名称,例如。电子邮件栏中的 smith@test.com 以及名为 smith@test.com.pdf 的 pdf 文件

解决此类问题的最佳 php 代码是什么?

最佳答案

尝试通过电子邮件发送 PDF 附件,

http://swiftmailer.org/docs/messages.html

关于php - 使用php将pdf附件发送到mysql数据库中的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31293218/

相关文章:

php - 搜索结果后如何更新库存数量?

php - 正确的set_error_handler()函数引用链接

php - [PHP/MySQL] : Is there a way to store text in Rich Text Format in MySQL table?

java - JavaFX 可以包含在 Java SE 项目中吗?

iphone - 如何使用 iPhone SDK 将表格输出到 PDF 文件?

java - 在 Java 中用于程序化 PDF 生成的 iText 是否有可靠的替代品?

php - 使用 PHP 从 URL 获取第一个目录

php - PHP获取URL中 "/"后的参数

mysql - 如何在spring data jpa中进行POJO投影以进行 native 查询

electron - Electron的printtopdf()可以使用应用程序名称 “content creator”标记生成的文档吗?