这是我的功能。我正在生成一个pdf并尝试邮寄它。我已经检查了我的电子邮件库,它工作正常,但生成的pdf为空白附件。
function voucherEmail()
{
$this->load->library('m_pdf');
ob_start();
$day = date('d');
$year = date('Y');
$month = date('F');
echo "Hello World Today is $month $day, $year";
$html = ob_get_contents();
ob_end_clean();
$this->m_pdf->pdf->WriteHTML(($html));
$content = $this->m_pdf->pdf->Output('','S');
$filename = "giftVoucher.pdf";
$config = array();
$config['useragent'] = "CodeIgniter";
$config['protocol'] = "sendmail";
$config['smtp_host'] = "localhost";
$config['smtp_port'] = "25";
$config['mailtype'] = "html";
$config['charset'] = "iso-8859-1";
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from('voucher@theholidaysclubs.com', 'The Holidays Club:Gift Voucher');
$this->email->to('shikhachauhan862@gmail.com');
$this->email->subject('The Holidays Club:Gift Voucher');
$this->email->attach($content,'attachment',$filename,'application/pdf');
$this->email->send();
}
有人可以请我出错吗