PHP使用php mail()函数发送带有pdf附件的电子邮件

时间:2017-03-08 22:49:42

标签: php email pdf

我需要将客户填写的表格的详细信息以pdf格式发送给店主作为附件,它不会使用php mail()方法发送pdf,它可以与phpmailer()一起使用

require_once("dompdf_config.inc.php");
    $dompdf = new DOMPDF();
    $dompdf->load_html($message1);
    $dompdf->render();
//$dompdf->stream("sample.pdf");exit;
    $pdf = $dompdf->output();
    $attachment = chunk_split(base64_encode($pdf));
    $filename = "vendor.pdf";


$mail = new Mail($config->get('config_mail'));
    //$mail = new Mail();
    $mail->addStringAttachment($pdf, $filename, $encoding = 'base64', $type = 'application/pdf', $disposition = 'attachment');
    $mail->setTo('owneremail@yahoo.com');
    $mail->setFrom($config->get('config_email'));
    //$mail->setFrom('info@mdpocket.com');
    $mail->setSender($config->get('config_name'));
    $mail->setSubject('Vendor Form');
    $mail->setText("Find Attached Files");
    $mail->addAttachment($path_of_uploaded_file);
    $mail->send();

addStringAttachment()函数在mail()方法中不起作用。我该如何发送pdf文件?

0 个答案:

没有答案