I have a php code in my website to send a mail for contact Us section. I want to show user's input in tabular format in mail body.
php code
<?php
try{
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$to = "[email protected]";
$response = mail($to, 'Query from website',
"<table>
<tr>
<th>Name</th>
<th>Contact Number</th>
<th>Email-Id</th>
<th>Comments</th>
</tr>
<tr>
<td>'.$name'</td>
<td>'.$phone'</td>
<td>'.$email'</td>
<td>.'$comments'</td>
</tr>
</table>
");
print_r($response);
} catch(Exception $e){
print_r($e);
}
?>
The issue is whole html code appears in mail body.