My script to send an email via PHP is not working and I don't know why as there is no specific error. Please advise:
[email protected] is replaced with my real email address.
udrew_email("[email protected]", $_REQUEST["txtEmail"], "Gears Message", $_REQUEST["txtName"], $_REQUEST["txtMessage"]);
<?php
function udrew_email($strTo, $strFromEmail, $strSubject, $strFromName, $strBody)
{
$strHeaders = "From: " . $strFromName . "<" . $strFromEmail . ">" . "\r\n";
if (mail($strTo, $strSubject, $strBody, $strHeaders)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed.</p>");
}
}
?>
I get "Message delivery failed."
I've also tried placing constants in all the variables instead of requesting from my form.
Any help would be appreciated. Thanks.