0
<?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: bookvenue01@gmail.com'       . "\r\n" .
                                 'Reply-To: bookvenue01@gmail.com' . "\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?

Bhavik
  • 43
  • 1
  • 7
  • 1
    You can't use `isHTML` because you're not using [PHPMailer](https://github.com/PHPMailer/PHPMailer). PHPMailer handles all this kind of formatting for you, plus it's a lot safer than using `mail()` directly. – Synchro Feb 18 '22 at 09:28

4 Answers4

0

Add this line

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

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

gre_gor
  • 6,669
  • 9
  • 47
  • 52
Ashish Rawat
  • 121
  • 6
0

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";
emrdev
  • 2,155
  • 3
  • 9
  • 15
0

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" />
Manohar P
  • 44
  • 3
0

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

                    $subject = 'Venue is Available';

                    $headers = 'From:bookvenue01@gmail.com';
                    $headers .= 'Reply-To: bookvenue01@gmail.com' . "\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);
}
Bhavik
  • 43
  • 1
  • 7