0
在這裏,我試圖發送附件的電子郵件,所有的代碼運行良好,但我沒有發現任何附件與郵件,但相同的文件正在打印超鏈接我已經給了成功的訊息。我在codeigniter中使用了php郵件類。發送附件失敗與PHP郵件函數codeigniter
public function sendmailto()
{
$this->load->library('phpmail');
$mail = new PHPMailer();
$body = "hello";
$mail->AddReplyTo("[email protected]","First Last");
$mail->SetFrom('[email protected]', 'First Last');
$mail->AddReplyTo("[email protected]","First Last");
$address = "[email protected]";
$mail->AddAddress($address, "John Doe");
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAttachment("../../uploads/a.pdf"); // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
else {
echo "Message sent!<a href='../../uploads/a.pdf' >click</a>" ;
}
}