我想将使用TCPDF创建的pdf文件附加到我的电子邮件中。
我就是这样做的:
$fileatt = $pdf->Output('file.pdf', 'E');
header("Location: mailto:someone@somepage.com?subject=my report&attachment=".$fileatt."&body=see attachment");
但是收到错误消息Warning: Header may not contain more than a single header
更新:
Fred -ii-
建议使用Swiftmail解决此问题:
$ fileatt = $ pdf->输出(' quotation.pdf',' E');
require_once 'swiftmailer/lib/swift_required.php';
// Create the mail transport configuration
$transport = Swift_MailTransport::newInstance();
// Create the message
$message = Swift_Message::newInstance();
$message->setTo(array(
"someone@somewhere.com" => "Someone",
));
$message->setSubject("This email is sent using Swift Mailer");
$message->setBody("You're our best client ever.");
$message->setFrom("someone@somewhere.com", "Your bank");
// Send the email
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
$message->attach(
Swift_Attachment::$fileatt);
但我仍然无法弄清楚,如何将其与mailto结合起来