Send Form to Email address problems

the mail() function

Moderators: egami, macek, gesf

Post Reply
developerahusain
New php-forum User
New php-forum User
Posts: 44
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow

Sun Jun 02, 2013 8:52 am

Here is the code friend. Actually 1 year back i developed this code through taking a tutorial about php mail php official website. This code will definitely work for you. And there is html form below this. You can modify and use it. Any problem do revert

$to =$_POST['to'];
$subject ='Job Opportunity @ m`brace';
$message ='<head>
<title>Untitled Document</title>
</head>

<body>
<table width="650" cellpadding="0" cellspacing="0" style="font-family:arial">
<tr><td><img src=logo.png width=150></td></tr>
</table>
</body>
</html>
';
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers
$headers .= 'From:'.$_POST['from']."\r\n";

mail($to,$subject,$message,$headers);
echo "<script language='javascript'>window.location='?do=msg1'</script>";

<form name="mail" method="post">
<table width="500" cellpadding="0" cellspacing="0" class="style12a" align="center">
<tr>
<td bgcolor="2459C2" colspan="2" class="style14f" align="center" ><strong>Send Mail</strong>
<input type="hidden" value="mbrace.cloud@gmail.com" name="from"></td>
</tr>
<tr><td colspan="3">&nbsp;</td></tr>
<tr>
<td width="200"><p class="subtextl">Name</p></td>
<td width="300"><p class="subtext_right">
<input type="text" name="name" value="" size="40">
</p></td>
</tr>
<tr>
<td width="200"><p class="subtextl">Email</p></td>
<td width="300"><p class="subtext_right">
<input type="text" name="to" value="" size="40">
</p></td>
</tr>
<tr><td colspan="3">&nbsp;</td></tr>
<tr valign="top" bgcolor="8FD8F9">
<td>&nbsp;</td>
<td><p class="subtext_right"><input type="submit" value="Send" name="submit" class="style_form">
</p></td>
</tr>
</table>
</form>
</body>
</html>

Regards
developerahusain

Post Reply