我已经编写了一些PHP代码来生成pdf(使用fpdf)并将其附加到联系表格7电子邮件中。目前,我生成了pdf,将其保存,然后提供该文件的路径。发送电子邮件后,我将其删除。
//1) Build the pdf with fpdf
//2) Output the pdf
$pdf->Output('/home/username/wp-content/uploads/'.'test.pdf', 'F');
//3) Attach the pdf to the email by specifying the path
$mail['attachments'] = '/home/username/wp-content/uploads/test.pdf';
//4) After the email has sent, delete the pdf
@unlink('/home/username/wp-content/uploads/test.pdf');
有没有一种方法而不必输出pdf?例如。将pdf对象直接附加到电子邮件,还是临时保存?