I have two files:
function emailTemplate() {
if($this->template) {
extract($this->email_data);
ob_start();
include_once("email_templates/".$this->template.".phtml");
return ob_get_clean();
}
}
and email template .phtml
<div>Hello, Your order has been accepted. <?= $some_data ?></div>
PHPmailer code:
$mail = new PHPMailer();
$mail->SetLanguage("cz");
$mail->IsSMTP();
$mail->Host = "smtp.some.cz";
$mail->SMTPAuth = true;
$mail->Username = "info@some.cz";
$mail->Password = "xysdff";
$mail->From = "info@some.cz";
$mail->FromName = "Some.cz";
$mail->AddAddress($this->xy);
$mail->AddBCC($this->xy2, 'potvrzení');
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $template;
$mail->AltBody = $template;
$mail->WordWrap = 50;
$mail->CharSet = "utf-8";
}
if(!$mail->Send()) {
throw new Exception($mail->ErrorInfo);
}
I send this email via PHPmailer, but it keep telling me that body of an email is empty but i get the email with right formating and data. Just this error message keep showing up. if i change include_once for just include, it send me two emails instead of one.
I don't see where the problem is
Thanks for help
EDIT: email came with normal data a right formated and second came empty...