我是php的新手,在构建页面的过程中一直在学习。我目前的任务是能够在浏览器中打开PDF,完成表格,并点击表格底部的按钮提交表格。
我们希望在不必将副本保存到服务器的情况下发送完成的表格。不过,两种形式的循环并不可怕。
我目前可以发送电子邮件,但脚本只发送空白文档。
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "xxx.xxx.xxx"; // SMTP server
$mail->From = "xxx@xxx.xxx";
$mail->AddAddress("xxx@xxx.xxx");
$mail->Subject = "Attachment Test";
$mail->Body = "Hi! nn This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
$mail->AddAttachment('tshirtorderform.pdf');
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
我意识到我在告诉它取回空白文件,但我在如何附上完整的表格上却一无所获
谢谢。
PHPmailer中有一个半文档化的AddStringAttachment()方法,它允许您直接从字符串附加,而不需要实际的磁盘文件:
http://phpmailer.worxware.com/index.php?pg=tutorial
搜索"字符串附件"。我不明白为什么它们没有在方法文档中列出。
我也推荐了AddStringAttachment()方法,但首先需要使用TCPDF来创建PDF的正文。
我在这个主题中给出了一些提示:PHPMailer中带有PDF的AddStringAttachment不工作