How can I send an email using php then add a template design in the email? I\'m using this:
$to = \"someone@example.com\";
$subject = \"Test mail\";
$mes
If you are using phpmailer then try this on
// Content
$mail->isHTML(true);
$mail->Subject = 'Newsletter Mail';
$mail->Body = file_get_contents('mail.html');
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
And if you are using php mail then just need to add
$body= file_get_contents('mail.html');
$headers = 'MIME-Version: 1.0'."\r\n";
$header.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n";
$header .="From:\r\n";
And if you are using CI(Codeigniter) then in my case I'm created mail helper of ci but rest work same
$message = $this->load->view('front/invoice_email',$data, TRUE); //"Hi, 9999999999 \r\n".";
if(!empty($adminEmail)) {
send_user_mail($adminEmail, $message, $subject);
}