我正在使用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')
发送罚款,但带有不正确的领域的身体秒。
有什么建议吗?