| Gary White 2004-03-10, 4:31 pm |
| On Wed, 10 Mar 2004 12:46:29 -0700, "Blair Rasmussen"
<brasmussen_ca@yahoo.com> wrote:
>Have a simple contact form in php:
>
>mail($emailTo, "Feedback from the Website", $message);
>
>Works fine - but now the from in Outlook displays "www-data" How can I
>configure it so the from is listed as the email address they enter on the
>previous page?
Assume, for this example, that your form has an input for "username" and
for "useremail":
$username=$_POST['username'];
$useremail=$_POST['useremail'];
$from=($username?$username:"Anonymous")
if($useremail)
$from.="<$useremail>";
$header="From: $from\r\n";
Now, in your call to the mail function, make it:
mail($emailTo, "Feedback from the Website", $message, $header);
Gary
|