Forum Moderators: coopster
$fmt_Response=implode("", file("http://www.domain_name.co.uk/thank_you_page.htm"));
$fmt_Mail=implode("", file("thehttfilename.htt"));
while(list($Key, $Val)= each($HTTP_POST_VARS)) {
$fmt_Response=str_replace("{$key}", $Val, $fmt_Response);
$fmt_Mail=str_replace("{$Key}", $Val, $fmt_Mail);
}
mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmt_Mail);
echo $fmt_Response;
?>
It works great but the mail arrives from the server with the "from" field set as "nobody". Can anyone tell me how to set this to something more meaningful? I don't need it to return the sender's email address. It would be fine if I could just set it to a constant, like from "Website Form Submission".
(Sorry if this is garbled but I don't do PHP).
<?
$sendEmail='youremail@youremail.com';
$additional_headers ="From: ".$sendEmail."" . "\r\n" . "Reply-To: ".$sendEmail."" . "\r\n";
$fmt_Response=implode("", file("http://www.domain_name.co.uk/thank_you_page.htm"));
$fmt_Mail=implode("", file("thehttfilename.htt"));
while(list($Key, $Val)= each($HTTP_POST_VARS)) {
$fmt_Response=str_replace("{$key}", $Val, $fmt_Response);
$fmt_Mail=str_replace("{$Key}", $Val, $fmt_Mail);
}
mail($HTTP_POST_VARS["recipient"], $HTTP_POST_VARS["subject"], $fmt_Maill,$additional_headers);
echo $fmt_Response;
?>
Another observation, you really don't want to be using the user submitted data right in the mail call, that snippet you originally have looks like an invitation for abuse.