|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/testregisgroup/contactUs/ |
Upload File : |
<?php
include ('appConstants.php');
$date=date("l, F dS, Y \a\\t H:i:s");
#Retrieve primary email recipient id from form
$emailRecipientId=$_REQUEST['bl_emailRecipientId'];
#Retrieve email subject
$subject=$_REQUEST['bl_emailSubject'];
if (trim($subject) == "") $subject="You have received a form submission!";
#Retrieve confirmation page redirect
$confirmationPageId=$_REQUEST['bl_confirmationPageId'];
$confirmationPage=$confirmationPages[$confirmationPageId];
# Create an empty message variable.
$message="";
# The mail that we want to use to recevie the submitted information.
$to=$emailRecipients[$emailRecipientId];
$lineDelimiter="\n";
$eol=$lineDelimiter;
$headers = 'From: ' . $emailFrom . $eol;
#Add any e-mail addressess as copy recipients
#foreach ($_REQUEST['bl_emailCcId'] as $value) {
#if (trim($value) != "")
# $headers .= 'Cc: ' . $emailRecipients[$value] . $eol;
#}
$headers .= 'Reply-To: ' . $replyTo . $eol;
$headers .= 'Return-Path: ' . $emailFrom . $eol; // these two to set reply address
$headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters
$headers .= "Content-Type: text/html;".$eol;
# Fields to Avoid
$ex=array();
$ex[]="submit"; # Where submit is the name of the submit button.
#Initialize Message
$message="Below is the result of the form. It was submitted on " . $date . ".<br/>";
$message .= "---------------------------------------------------------------------------------------<br/><br/>";
# iterate the $_POST array
foreach ($_POST as $key=>$value) {
if (!in_array($key, $ex)) {
$keyPrefix=substr($key, 0, 3);
if ($keyPrefix!="bl_" ) $message.=$key.": " . preprocessHeaderField($value) . "<br/>";
}
}
# Send message by e-mail.
#print $to . $subject . $message . $headers;
$sm=mail($to, $subject, $message, $headers);
#Add any e-mail addressess as copy recipients
foreach ($_REQUEST['bl_emailCcId'] as $value) {
if (trim($value) != "")
$sm=mail($emailRecipients[$value], $subject, $message, $headers);
}
#if (!$sm) {
#print "Cannot send e-mail.";
#}else{
#print "E-Mail was sent.";
#}
#Forward the user to the appropriate confirmation page
header("Location: ".$confirmationPage);
#The following function helps protect the form from being hijacked by spammers. Basically put, it
#strips away any forced headers.
function preprocessHeaderField($value)
{
//Remove line feeds
$ret = str_replace("\r", " ", $value);
$ret = str_replace("\n", " ", $ret);
// Remove injected headers
$find = array("/bcc\:/i",
"/Content\-Type\:/i",
"/Mime\-Type\:/i",
"/cc\:/i",
"/to\:/i");
$ret = preg_replace($find,
"**bogus header removed**",
$ret);
return $ret;
}
#$thankyou=file_get_contents ( $confirmationPage);
#print $thankyou;
?>