Sou*_*Das 0 email codeigniter mpdf
在我的控制器中生成 pdf 布局,然后将其附加为 Pdf 并使用自定义文件名。这是代码
$this->load->library('mpdf');
$mpdf = new Mpdf('L', 'A4', 0, 'Trebuchet MS', 6, 6, 9, 9, 3, 3, 'L');
ob_start();
echo $this->generateFoodReport($inspectionId);
$html = ob_get_contents();
ob_end_clean();
$mpdf->WriteHTML(utf8_encode($html));
$content = chunk_split(base64_encode($mpdf->Output('', 'S')));
$filename = "inspection-report.pdf";
$this->load->library('email');
$this->email->set_mailtype("html");
$this->email->set_newline("\r\n");
$this->email->from($fromMail, $fromName);
$this->email->to($mailTo);
$this->email->subject($subject);
$this->email->attach($content):
$this->email->send();
Run Code Online (Sandbox Code Playgroud)
如何通过电子邮件附加文件。
将纯 PDF 缓冲区发送到邮件类。
$content = $mpdf->Output('', 'S');
$this->email->attach($content, 'attachment', $filename, 'application/pdf');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5084 次 |
最近记录: |