$message = str_replace("\n",'
',$message);
$error = array();
//Let's see who they are sending it to, and use the correct email.
if($to == 'sales')
{
$to = 'sales@hostmaven.com';
//Adds an identifier for the helpdesk.
$subject = "Sales - $subject";
}
elseif($to == 'general')
{
$to = 'sales@hostmaven.com';
//Adds an identifier for the helpdesk.
$subject = "General - $subject";
}
else
{
$error[] = 'Please make sure you have chosen who to send the email to.';
}
//Makes sure the necessary fields are filled out.
if(empty($from_name))
{
$error[] = 'You did not enter your name.';
}
if(empty($from_email))
{
$error[] = 'Enter your email address.';
}
if(empty($message))
{
$error[] = 'Please enter your message.';
}
//Sees if $error is empty.
if(!count($error))
{
//Additional headers.
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $from_email" . "\r\n" . "Reply-To: $from_email" . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//Sends.
$send_email = mail($to,$subject,$message,$headers,'');
if($send_email == true)
{
echo "
Email has been sent. We will try and reply shortly.
";
}
else
{
echo "
Email could NOT be sent. Please try again later.
";
}
}
else
{
$email_msg = implode('
',$error);
}
}
?>
display('footer.tpl');
?>