Search code examples
phphtmlphpmailer

sending mail through phpmailer and its working properly but the problem is i have inserted one templet in it and i am receiving code of that templet


<?php   
function sendCOTP($REmail,$RVID) {
                $to      = $REmail;
                    $subject = 'Allloooooooooooo Bhindiiiiiii';
                    ob_start();
                    include './mailtemplet.php';
                    $body = ob_get_clean();
                    
                    $message = 'Dear,sir'
                            . 'Guess what ??? '.$RVID.' venue that you checked earlear is now finallyyy available so check it out and book it before again it get booked '
                            . 'Thank you'
                            . 'team venueazy';
                    $headers = 'From: [email protected]'       . "\r\n" .
                                 'Reply-To: [email protected]' . "\r\n" .
                                 'X-Mailer: PHP/' . phpversion();

                    mail($to, $subject,$body, $message, $headers);
}

?>

so here everything is working fine but the templet which i have included that is not working like i am getting html code instead of that templet so need help with that how can i solve this issue.

thank you in advance.Mail screenshot where i am getting html code instead of templet

need help is how can i make "IsHTML(true);" in my code?


Solution

  • function sendCOTP($REmail,$RVID) { $to = $REmail;

                        $subject = 'Venue is Available';
    
                        $headers = 'From:[email protected]';
                        $headers .= 'Reply-To: [email protected]' . "\r\n";
                        $headers .= "MIME-Version: 1.0\r\n";
                        $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
    
                        $email_template = './mailtemplet.html';
                        
                        $message = file_get_contents($email_template);
    
                        mail($to, $subject, $message, $headers);
    }