Re: mail prob
| From: | David Robley | Date: | Fri, 23 Feb 2001 06:09:45 +0000 |
| Subject: | Re: mail prob | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41268@lists.php.net to get a copy of this message | ||
On Fri, 23 Feb 2001 16:32, W.D. wrote:
> so there is no way to pull this variable from an email form field?
>
> > From: "W.D." <suedeuno@yahoo.com>
> >
> > > I'm using a remote host, and when I call mail() with all the var's
>
> pulling
>
> > > values from form fields, it still shows as nobody in from header.
> > > Is
>
> this
>
> > a
> >
> > > server situation? Theyre using php4 support and they claim its that
> > > I'm
> >
> > not
> >
> > > using appropriate variables in the function.
> >
> > You have to set the From header manually:
> >
> >
> > <?php
> > $to = "who@where.com";
> > $from = "me@myserver.com";
> > $subject = "Blah";
> > $body = "Lorem ipsum dolor sit amet.";
> >
> > mail($to, $subject, $body, "From: $from");
> > ?>
> >
> >
> > http://www.php.net/manual/en/function.mail.php
> >
> >
> > Regards
> >
> > Simon Garner
Well, you can use a variable from _anywhere_ Simon's example uses a
variable set locally just so you can see exactly what is going on.
But if you had a form element called, say, reply_address in which the
user types an email address, you could pass that as the fourth argument
to mail().
Of course, in this case you have no control over the accuracy or validity
of the address entered. But that's a whole different question - search
the archives for info on validating email addresses. And somebody has
published a class somewhere?
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA