Hi All....

Actually I wanted to send mail through mail function in php...

The mail is sent successfully and I'm receiving it in the inbox...

Problem is I want the mail content in HTML format not plain text.

I've tried this code, but it doesn't seem to work...

<?php

/* =============   Sending Mail, This is a php file which runs when User fills a form and clicks submit, the form data are collected in those variables below   ============== */



$name= $_REQUEST['name'];
$email= $_REQUEST['email'];
$city= $_REQUEST['city'];
$state= $_REQUEST['state'];
$country= $_REQUEST['country'];
$phone= $_REQUEST['phone'];
$profession= $_REQUEST['profession'];
$message= $_REQUEST['message'];


$message1 = '<html><body>';

$message1 .= '<table style="border-color: #666;" cellpadding="10">';
$message1 .= "<tr><td><strong>Name:</strong> </td><td>" . $_POST['name'] . "</td></tr>";
$message1 .= "<tr><td><strong>Email:</strong> </td><td>" . $_POST['email'] . "</td></tr>";
$message1 .= "<tr><td><strong>City:</strong> </td><td>" . $_POST['city'] . "</td></tr>";
$message1 .= "<tr><td><strong>State:</strong> </td><td>" . $_POST['state'] . "</td></tr>";
$message1 .= "<tr><td><strong>Message:</strong> </td><td>" . $_POST['message'] . "</td></tr>";

$message1 .= '</table>';
$message1 .= '</body></html>';




$to= "yogeshnaik6686@gmail.com";



$subject= "Student Data";
$email= $_REQUEST['email'];

$headers="From: $email";
$sent=mail($to,$subject,$message1,$headers);

if($sent)
{
echo "Data Sent Successfully";
}
else
{
echo "Error Sending Data.";
}


?>

Problem is I'm getting the mail, but along with the data all <html> tags are also present.........

Is there any way to show only data in proper html tabular form.....

I think Problem is somewhere in the red marked region........But don't know where exactly it is :-O ..........


Regards

Thanx Sir, Yes it did worked.......:icon_mrgreen:

Regards.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.