Saturday, 28 May 2016

mail function

<?php
if(isset($_POST['submit'])){
    $to = "web@companyname.com";
    $from = $_POST['email'];
    $name = $_POST['name'];
   
$address=$_POST['address'];
$city=$_POST['city'];
$country=$POST['country'];
$mobile=$_POST['mobile'];

$event=$_POST['event'];
$venu=$_POST['venu'];
$fromdate=$_POST['fromdate'];
$todate=$_POST['todate'];
$comment=$_POST['comment'];
   
   
   
   
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $name ."  wrote the following:\n". "" . $address ."\n".$city."".$country. "\n" .$mobile. "\n" .$event. "\n" .$venu. "\n" .$fromdate. "\n".$todate. "\n" .$comment. "\n" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $name . "" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2);
    echo "Mail Sent. Thank you " . $name . ", we will contact you shortly.";
   
    }
?>

No comments:

Post a Comment