【发布时间】:2016-06-02 08:40:32
【问题描述】:
我编写了一个函数来发送带有附件的电子邮件。我使用了 PHPMailer 类。 已发送电子邮件,但收不到附件。
我的控制器代码
public function send_mail()
{
$this->load->library('email');
$subject = 'Request For Quotation';
$message = '<p>This message has been sent for testing purposes.</p>';
// Get full html:
$body =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset='.strtolower(config_item('charset')).'" />
<title>'.html_escape($subject).'</title>
<style type="text/css">
body {
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
'.$message.'
</body>
//</html>';
$this->load->library('M_pdf');
$this->m_pdf->pdf->setTitle('Request for Quotation');
$html = 'hiiiiiiiiiiiiiiiiiiiiiiiiiiiiii';
$this->m_pdf->pdf->WriteHTML($html);
$content=$this->m_pdf->pdf->Output('RFQ.pdf',"S");
$result = $this->email->from('mm@jiklink.com')->to('jk@gmail.com')->subject($subject)->message($body)->attach($content, '', 'base64', '')->send();
var_dump($result); // echo '<br />'; echo $this->email->print_debugger(); exit;
}
【问题讨论】:
-
从毫无意义的流畅界面中获益。添加一些异常处理和/或检查您的返回值。
-
你能帮帮我吗,我尝试了很多,但没有得到
-
我使用 PHPMailer 和 codeigniter
标签: codeigniter codeigniter-2 phpmailer codeigniter-3