I wonder if anyone can help me with this. I am a novice when it comes to PHP and I'm currently finding that the response form I'm using sends responses to my spam box instead of my inbox. I would really appreciate any advice on how to correct this problem. The PHP code is pasted below. Thanks very much in advance... Ian.
// Include extra form fields and/or submitter data? // false = do not include $extra = array( \"form_subject\" => true, \"form_cc\" => true, \"ip\" => true, \"user_agent\" => true );
// Process $action = isset($_POST[\"action\"]) ? $_POST[\"action\"] : \"\"; if (empty($action)) { // Send back the contact form HTML $output = \"<div style='display:none'> <div class='contact-top'></div> <div class='contact-content'> <h1 class='contact-title'>Send us a message:</h1> <div class='contact-loading' style='display:none'></div> <div class='contact-message' style='display:none'></div> <form action='#' style='display:none'> <label for='contact-name'>*Name:</label> <input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' /> <label for='contact-email'>*Email:</label> <input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' />\";
// make sure the token matches if ($token === smcf_token($to)) { smcf_send($name, $email, $subject, $message, $cc); echo \"Your message was successfully sent.\"; } else { echo \"Unfortunately, your message could not be verified.\"; } }
function smcf_token($s) { return md5(\"smcf-\" . $s . date(\"WY\")); }
// Validate and send email function smcf_send($name, $email, $subject, $message, $cc) { global $to, $extra;
// Filter and validate fields $name = smcf_filter($name); $subject = smcf_filter($subject); $email = smcf_filter($email); if (!smcf_validate_email($email)) { $subject .= \" - invalid email\"; $message .= \"\n\nBad email: $email\"; $email = $to; $cc = 0; // do not CC \"sender\" }
// Add additional info to the message if ($extra[\"ip\"]) { $message .= \"\n\nIP: \" . $_SERVER[\"REMOTE_ADDR\"]; } if ($extra[\"user_agent\"]) { $message .= \"\n\nUSER AGENT: \" . $_SERVER[\"HTTP_USER_AGENT\"]; }
// Set and wordwrap message body $body = \"From: $name\n\n\"; $body .= \"Message: $message\"; $body = wordwrap($body, 70);
// Make sure local and domain don't start with or end with a period if (preg_match(\"/(^\.|\.$)/\", $local) || preg_match(\"/(^\.|\.$)/\", $domain)) return false;
// Check for quoted-string addresses // Since almost anything is allowed in a quoted-string address, // we're just going to let them go through if (!preg_match('/^\"(.+)\"$/', $local)) { // It's a dot-string address...check for valid characters if (!preg_match('/^[-a-zA-Z0-9!#$%*\/?|^{}`~&\'+=_\.]*$/', $local)) return false; }
// Make sure domain contains only valid characters and at least one period if (!preg_match(\"/^[-a-zA-Z0-9\.]*$/\", $domain) || !strpos($domain, \".\")) return false;
Not sure that my client would appreciate having to constantly go to their spam box to check for messages from their web form and always have to mark them as "not spam".
As these guys said, if your email client is marking it as spam you can configure not to do that. Usually this is by clicking on "This is not spam" or similar. Alternatively you can add the sending email address to your address book.
I wonder if anyone can help me with this.
I am a novice when it comes to PHP and I'm currently finding that the response form I'm using sends responses to my spam box instead of my inbox.
I would really appreciate any advice on how to correct this problem. The PHP code is pasted below.
Thanks very much in advance...
Ian.
For a list of client specific suggestions you might find http://www.catster.com/faq_email.php helpful.
Best regards
Dave