<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['user_email'] ;
$name = $_REQUEST['user_name'] ;
$headers = "From: our Company";
$subject = "Rental Lead";


$fields = array();
$fields{"user_name"} = "Name";
$fields{"user_email"} = "Email";
$fields{"user_phone"} = "Phone";
$fields{"company"} = "Company Info"; 
$fields{"item"} = "Item"; 
$fields{"message"} = "Message"; 


$body = "This is a Rental Lead. Please contact the person below to fulfill the rental request.\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

$headers2 = "From: Our Company";
$subject2 = "Thank you for Our Company";
$confirm = "The following information has been sent to the Rental Company. If you do not hear from the rental company, please contact us and we will assist you on your rental needs. Please keep this for your records.:\n\n"; foreach($fields as $a => $b){ $confirm .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $confirm, $headers2);


if($send)
{header( "Location: http://www.rentittoday.com/thank_you.php" );}
else
{print "We encountered an error sending your mail, please notify support@RentItToday.com"; }
}
}
?> 

