From: "W.D." <[EMAIL PROTECTED]>

> yea I guess that would work better, I dunno tho, I tried setting $from =
> $Email and the blasted server still served it up as nobody in the header.
> But the rest would make more sense. Yes [EMAIL PROTECTED] would need a copy
to
> trigger an autoresponse. I know I probably seem like someone who hasnt
read
> much php, but Ive actually read a couple php4books, the first an easier
> learning and the second PHP 4 Bible. I'm still a newbie tho so bare with
me.
>


Okay, it sounds like you're forgetting the "From: " prefix in front of
$from.

This prefix is necessary because the mail message you are composing must
come out looking essentially like this (this is what gets given to your SMTP
mail server):



To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Blah

Here is the main body of the message.



Now, PHP's mail() function will automatically insert the To: and Subject:
headers, and the body, from the first three arguments to mail(). But to add
the custom From: and Cc: headers, you have to add them yourself (correctly
formatted as mail headers) using the fourth argument to mail().

Which is how we get to:

mail("[EMAIL PROTECTED]", $subject, $message,
    "From: $from\nCc: [EMAIL PROTECTED]");

Making sense? :)



>
>
> > From: "W.D." <[EMAIL PROTECTED]>
> >
> > > <form method="POST" action="<?php print ($PHP_SELF);?>">
> > > First Name: <input type=TEXT name="FirstName" size=15><p>
> > > Last Name: <input type=TEXT name="LastName" size=25><p>
> > > E-mail Address: <input type=TEXT name="Email" size=25><p>
> > > <textarea name="Info" rows="5" cols="40" wrap=SOFT>Ask a
> > > Question</textarea><p>
> > > <input type=SUBMIT> <input type=RESET>
> > > </font>
> > > </form>
> > >
> > >
> > > <?php
> > > $from = $FirstName ." ". $LastName;
> > > $subject = $Email;
> > > $message = $Info;
> > > mail("[EMAIL PROTECTED], [EMAIL PROTECTED], $subject, $message,
$from);
> > > ?>
> > >
> >
> >
> > See, your syntax is incorrect :P
> >
> > Try:
> >
> > <?php
> >     $from = $Email;
> >     $subject = $Email;
> >     $message = "Question from $FirstName $LastName:\n\n$Info";
> >
> >     mail("[EMAIL PROTECTED]", $subject, $message, "From: $from\nCc:
> > [EMAIL PROTECTED]");
> > ?>
> >
> > I'm assuming you wanted to send a copy to [EMAIL PROTECTED]
> >
> > Please read the docs for mail(): http://php.net/mail
> >
> >
> > Regards
> >
> > Simon Garner
> >



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to