Thanks for not doing your work and taking the time to help me out!
I'm using 0.11.2 now, not 0.11.1 since it had the contact form injection problems, but that didn't stop me from trying out your code. It seems to work just fine... test messages show the IP and other variables great... so I hope I didn't break anything I'm not aware of.
Again, thanks for the help. It's appreciated.
A email address to send to must be specified in order to use this plugin.';
return;
}else{
$to = $params['email'];
}
$style = true;
if (!empty($params['style']))$style = $params['style'];
$name=$email=$subject=$message = '';
if($_SERVER['REQUEST_METHOD']=='POST'){
if (!empty($_POST['name'])) $name = cfSanitize($_POST['name']);
if (!empty($_POST['email'])) $email = cfSanitize($_POST['email']);
if (!empty($_POST['subject'])) $subject = cfSanitize($_POST['subject']);
if (!empty($_POST['message'])) $message = cfSanitize($_POST['message']);
$env_report = $_SERVER["REMOTE_ADDR"] . ', ' . $_SERVER["HTTP_USER_AGENT"];
$message .= "\n\nenv_report == " . $env_report;
$extra = "From: $name \r\nReply-To: $email\r\n";
echo '';
if (empty($name)) {
echo 'Please Enter Your Name.';
}elseif (empty($email)) {
echo 'Please Enter Your Email Address.';
}elseif (empty($subject)) {
echo 'Please Enter a Subject.';
}elseif (empty($message)) {
echo 'Please Enter a Message.';
}elseif (!validEmail($email)) {
echo 'Your Email Address is Not Valid.';
}elseif (@mail($to, $subject, $message, $extra)){
echo "Your message was successfully sent.";
return;
}else{
echo 'Sorry, the message was not sent. The server may be down!';
return;
}
echo '';
}
?>
" method="post" name="contactForm">
Your Name:" size="50" />
Your Email Address:" size="50" />
Subject:" size="50" />
Message:>
What does this do?
Display's a contact form. This can be used to allow others to send an email message to the address specified.
How do I use it?
Just insert the tag into your template/page like: {contact_form email="
yourname@yourdomain.com"}
If you would like to send an email to multiple adresses, seperate each address with a comma.
What parameters does it take?
email - The email address that the message will be sent to.
(optional)style - true/false, use the predefined styles. Default is true.
Author: Brett Batie<
brett-cms@classicwebdevelopment.com>
Version: 1.1
Change History:
None