<?php
//#######################################################################\\
//# Author: Christopher Schiffner - hide@address.com #\\
//# Filename: pandamailer.php #\\
//# Copyright: Creative Commons Attribution-Noncommercial 3.0 Unported #\\
//# #\\
//# License: This software is free to use for personal applications. #\\
//# There is a small registration fee for commercial #\\
//# applications. Please contact hide@address.com if #\\
//# you wish to use this program on a commercial website. #\\
//#######################################################################\\
require "pandamailer_config.php";
@session_name($sessionIdentifier);
@session_start();
$challenge=strtolower($_SESSION['captcha']);
$response=strtolower(trim($_POST['response']));
$from=$_POST['from'];
$subject=$_POST['subject'];
$message=$_POST['message'];
//perform our error checking and provide the user with feedback
if($challenge=="" || $response=="" || $from=="" || $subject=="" || $message==""){
$message=urlencode($message);
$subject=urlencode($subject);
$from=urlencode($from);
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php?error=fieldBlank&from=$from&message=$message&subject=$subject");
}else if($challenge!=$response){
$message=urlencode($message);
$subject=urlencode($subject);
$from=urlencode($from);
header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php?error=codeMismatch&from=$from&message=$message&subject=$subject");
}else{
// To send the HTML mail we need to set the Content-type header.
$eol="\r\n";
$headers = "From: ".$from.$eol;
$headers .= "Reply-To: ".$from.$eol;
$headers .= "Return-Path: ".$from.$eol;
$headers .= "Message-ID: <".$now.$from.">".$eol;
$headers .= "X-Mailer: PHP/".phpversion().$eol;
$mime_boundary=md5(time());
$headers .= "MIME-Version: 1.0".$eol;
$headers .= "Content-type: text/plain; charset=UTF-8".$eol;
//send the email!
mail($to,$subject,$message,$headers);
//EDIT THIS LINK TO GO TO WHATEVER PAGE YOU WISH
header("Location: $redirect");
}
?>