This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2004 > OT php mail





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author OT php mail
Blair Rasmussen

2004-03-10, 4:30 pm

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?

--
--
Regards,

Blair Rasmussen
Oshima Web Solutions
------------------------------
http://www.oshima.ca
http://www.albertarowing.ca
------------------------------



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
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews