Home > Back-end >  sending mail through phpmailer and its working properly but the problem is i have inserted one templ
sending mail through phpmailer and its working properly but the problem is i have inserted one templ

Time:02-18

<?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?

CodePudding user response:

add this line

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

this link will help you. Send HTML in email via PHP

CodePudding user response:

It looks like you forgot to include a header when submitting, add this to your code after Reply-To

$headers .= "Content-Type: text/html;\r\n";

CodePudding user response:

use this meta tag inside your head tag .you must specify content type.else it can be take it as string.that's why your whole code displayed in mail.

 <meta http-equiv="Content-Type"  content="text/html charset=UTF-8" />
  • Related