I need to send mail through html form .

Posted by Sekar.C under Others on 2/24/2014 | Points: 10 | Views : 1269 | Status : [Member] | Replies : 1
I have html contact form it call send.php file for send mail but not send mail
Please give any idea to send mail.
For your reference attached same code .
My contact form:
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="file send.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
file send.php:
<?php

// Contact subject
$subject =$_POST["subject"];

// Details
$message=$_POST["detail"];

// Mail of sender
$mail_from=$_POST["customer_mail"];

// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='xxxxxx@yopmail.com';
$send_contact=mail($to,$subject,$message,$header);

// 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";


Regards
Sekar.c



Responses

Posted by: Vuyiswamb on: 4/17/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Create a Web api that sends an email and use a fuction like i did here

http://www.dotnetfunda.com/articles/show/747/how-to-send-an-e-mail-using-gmail-in-aspnet

and call that web api in JQuery lie i did here

http://www.dotnetfunda.com/codes/show/6273/how-to-bind-a-dropdown-from-a-web-api-in-jquery

it should work

Thank you for posting at Dotnetfunda
[Administrator]

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response