Almost every website have query forms where user can send their queries and website owners can get the mail of the user query.
Here I'm writing the PHP code to send the email. In this code I am emailing the customer by noreply mail so that I can send an acknowledgement to customer that we have received your email and will get back to you soon.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
if($_POST['submit']!=''){
$txtname=addslashes($_POST['name']);
$city=addslashes($_POST['city']);
$email=addslashes($_POST['email']);
$phone=addslashes($_POST['phone']);
$to="info@www.coding4developers.com";
$body.="Name : ".$txtname."<br>";
$body.="City : ".$city."<br>";
$body.="Email Id : ".$email."<br>";
$body.="Phone : ".$phone."<br>";
$from = 'MIME-Version: 1.0' . "\r\n";
$from.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$from.= 'From: <'.$txtemail.'>' . "\r\n";
$subject="New Career mail to - coding4developers";
mail($to,$subject,$body,$from);
/// mail to customer
$to=$txtemail;
$subject="Thanks for your valueable Enquiry in coding4developers";
$body="Dear ".$txtname."<br><br>";
$body.="Thanks for showing your intrest in coding4developers<br>We will contact you soon.<br><br>";
$body.="Regards<br>";
$body.="Coding 4 Developers<br><br><br><br>";
$from = 'MIME-Version: 1.0' . "\r\n";
$from.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$from.= 'From: <no-reply@www.coding4developers.com>' . "\r\n";
mail($to,$subject,$body,$from);
header('location:index.php?message=success');
}
?>
|