radow
Junior Poster in Training
73 posts since Oct 2012
Reputation Points: 7
Solved Threads: 18
Skill Endorsements: 0
See first of all your server must have SMTP support otherwise you can't send mail.
First checks that.If it supports SMTP then check mail method of php.
Click Here.
Syntax is :
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
So in your case it would be somethink like this:-
<?php
If($_POST)
{
// Contact subject
$name=$_POST['name'];
$subject =$_POST['subject'];
$detail = $_POST['message'];
$mail_from=$name=$_POST['email'];
// Details
$message= $detail;//you can format message as the header content type is html.So you can add HTML tags
// Mail of sender
$mail_from=$name=$_POST['email'];
// From
$headers = "From: ". $_POST['to'] . "\r\n" .
"Content-type: text/html; charset=UTF-8" . "\r\n".
// Enter your email address
$to ='bala_palash@yahoo.com';
$send_contact=mail($to,$subject,$message,$headers);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}}
?>
<form name="form1" method="post" action="">
<p> </p>
<p> </p>
<table width="500" border="0" cellspacing="0">
<tr>
<td>Your Name</td>
<td><label>
<input type="text" name="name" id="name">
</label></td>
</tr>
<tr>
<td>Your Email</td>
<td><label>
<input type="text" name="email" id="email">
</label></td>
</tr>
<tr>
<td>Subject</td>
<td><label>
<input type="text" name="subject" id="subject">
</label></td>
</tr>
<tr>
<td>Message</td>
<td><label>
<input type="text" name="message" id="message">
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit">
</label>
</p>
</form>
IIM
Practically a Master Poster
638 posts since Jun 2011
Reputation Points: 127
Solved Threads: 136
Skill Endorsements: 7