Having some serious difficulty getting our php email system working after implementing an image captcha to stop the hundreds of bots spamming it.
I may as well post the src first:
Subscription Form:
Expand|Select|Wrap|Line Numbers
- <form action="newsletter.php" method="post" enctype="multipart/form-data" name="form" id="form">
- <label>Your Email Address:
- <input type="addemail" name="textfield" id="addemail">
- </label>
- <p><img src="CaptchaSecurityImages.php" />
- <br>
- Security Code:
- <input id="security_code" name="security_code" type="text" />
- <br>
- <input type="submit" name="submit" value="Submit" />
- <br>
- </p>
- </form>
[PHP]<?php
session_start();
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
// Insert your code for processing the form here, e.g emailing the submission, entering it into a database.
$to = "newsletter@boccaccio.com.au";
$subject = "New Mailing List Entry - $email";
$email = $_REQUEST['addemail'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Thankyou. Your subscription has been successful. You will now be redirected home..."; }
echo "<META http-equiv='Refresh' content='5; url=http://www.boccaccio.com.au'>";
unset($_SESSION['security_code']);
} else {
{print "Incorrect security code. Please try again. You will now be redirected back..."; }
echo "<META http-equiv='Refresh' content='5; url=http://www.boccaccio.com.au/join.html'>";
// Insert your code for showing an error message here
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Boccaccio Cellars Newsletter Subscription</title>
</head>
<body>
[/PHP]
Now, the problem is, i'm suddely only receiving blank emails, when in order for our subscription program to work it needs their email in the subject line and also in the 'from' field.
Any help appreciated, (You can view the page on www.boccaccio.com.au/join.htm)
Cheers.