Hi Everyone,
I’m trying to send data from a contact form to an email address on yahoo. I placed in the below PHP, but the recipient is not receiving any email from the server. My developer’s asleep and I’m at a loss as to why this isn’t working. If someone could look over the below code, maybe you see something I may have missed?
Cheers,
Tricky
[code=php]
<?php
function cleanupName($string, $length = 50)
{
$string = stripslashes($string);
$string = preg_replace(“/[^a-zA-Z0-9.-]/”, “”, $string);
$string = substr($string, 0, $length);
return $string;
}
function cleanupPhone($string, $length = 20)
{
$string = stripslashes($string);
$string = preg_replace(“/[^()-0-9]/”, “”, $string);
$string = substr($string, 0, $length);
return $string;
}
function cleanupEMail($string, $length = 50)
{
$string = stripslashes($string);
$string = preg_replace(“/[, :;<>]/”, “”, $string);
$string = substr($string, 0, $length);
return $string;
}
function cleanupComment($string, $length = 500)
{
$string = stripslashes($string);
$string = preg_replace(“/[<>:;]/”, “”, $string);
$string = substr($string, 0, $length);
return $string;
}
if (isset($_POST[‘name’])) $name = cleanupName(urldecode($_POST[‘name’]));
if (isset($_POST[‘company’])) $company = cleanupName(urldecode($_POST[‘company’]));
if (isset($_POST[‘phone’])) $phone = cleanupPhone(urldecode($_POST[‘phone’]));
if (isset($_POST[’email’])) $email = cleanupEMail(urldecode($_POST[’email’]));
if (isset($_POST[‘comment’])) $comment = cleanupComment(urldecode($_POST[‘comment’]));
$recipientAddress =
“[email protected]”;
$subject =
“Re: Web Site Contact Request”;
$body =
“Name: ” . $name . “rn” .
“Company: ” . $company . “rn” .
“Phone: ” . $phone . “rn” .
“E-Mail: ” . $email . “rn” .
“Comment: ” . $comment;
$headers =
“From: Tricky Fingers <[email protected]>”;
mail($recipientAddress, $subject, $body, $headers);
?>