我正在使用PHPmailer爲客戶發送電子優惠券。我想向用戶發送一個動態的html文檔作爲正文,但是當我參考這個文件時,我得到一個錯誤。PHPMailer - 無法加載MsgHTML
我的代碼如下:
$sessionid = '12345';
$cid = '98765';
require('class.phpmailer.php');
$bodytext1 = "Your Evoucher is attached for ".$row_checkout['name'];
$email = new PHPMailer();
$email->From = '[email protected]';
$email->FromName = 'xxx.com';
$email->Subject = 'Your e-voucher for '.$row_checkout['name'];
$email->AddAddress($row_user['email']);
$email->MsgHTML(file_get_contents('mail.php?sid='.$sessionid.'&cid='.$cartid));
$file_to_attach = $sessionid.'/'.$bookingid.'.pdf';
$email->AddAttachment($file_to_attach , $bookingid.'.pdf');
return $email->Send();
當我運行它,我得到以下錯誤:
Warning: file_get_contents(mail.php?sid=12345&cid=98765) [function.file-get-contents]: failed to open stream: No such file or directory in /home4/mission/public_html/xxx.com/evoucher/new/createandmail.php on line 93
但是,如果我不把這些變量中的URL,即
$email->MsgHTML(file_get_contents('mail.php')
發送罰款,但帶有不正確的領域的身體秒。
有什麼建議嗎?