RE: [PHP] mail prob

2001-02-23 Thread PHPBeginner.com

just get some examples from php.net/mail

and pass the variables to it any way you wish - it all will work


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: W.D. [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 2:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mail prob


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.

 _ Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
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]



-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread Simon Garner

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]>
> >
> > > 
> > > First Name: 
> > > Last Name: 
> > > E-mail Address: 
> > > Ask a
> > > Question
> > >  
> > > 
> > > 
> > >
> > >
> > >  > > $from = $FirstName ." ". $LastName;
> > > $subject = $Email;
> > > $message = $Info;
> > > mail("[EMAIL PROTECTED], [EMAIL PROTECTED], $subject, $message,
$from);
> > > ?>
> > >
> >
> >
> > See, your syntax is incorrect :P
> >
> > Try:
> >
> >  > $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]




Re: [PHP] mail prob

2001-02-22 Thread David Robley

On Fri, 23 Feb 2001 16:52, W.D. wrote:
> 
> First Name: 
> Last Name: 
> E-mail Address: 
> Ask a
> Question
>  
> 
> 
>
>
>  $from = $FirstName ." ". $LastName;
> $subject = $Email;
> $message = $Info;
> mail("[EMAIL PROTECTED], [EMAIL PROTECTED], $subject, $message,
> $from); ?>
>

You seem to have gotten a little confuzzed here! $from should contain the 
email address which you are collecting as $Email and presumably $Info is 
the message body and I'm not quite sure what you want in the subject, but 
all you have available is first and last names!

And then, you need a check to see what action should be taken when you 
call this script - at the moment every time you open the script you send, 
or try to send, an empty mail. Perhaps assigning a name and value to your 
submit button and testing for that?

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

-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread Simon Garner

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

> 
> First Name: 
> Last Name: 
> E-mail Address: 
> Ask a
> Question
>  
> 
> 
>
>
>  $from = $FirstName ." ". $LastName;
> $subject = $Email;
> $message = $Info;
> mail("[EMAIL PROTECTED], [EMAIL PROTECTED], $subject, $message, $from);
> ?>
>


See, your syntax is incorrect :P

Try:



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]




Re: [PHP] mail prob

2001-02-22 Thread W.D.


First Name: 
Last Name: 
E-mail Address: 
Ask a
Question
 








> From: "W.D." <[EMAIL PROTECTED]>
>
> > well this is actually what I did tho, I used an $email var and set it
too
> > $from which I used mail()and it still came out as nobody
> >
>
>
> Can you show us the PHP code you're using please.
>
> Ta
>
>
>
>
>
> > > From: "W.D." <[EMAIL PROTECTED]>
> > >
> > > > so there is no way to pull this variable from an email form field?
> > > >
> > >
> > >
> > > Eh? Of course, $from can be set by a form field if you want. Or a
> > database,
> > > or any way you can set a variable. Then pass it to mail(), per my last
> > > message.
> > >
> > >
> > >
> > >
> > > >
> > > >
> > > > > From: "W.D." <[EMAIL PROTECTED]>
> > > > >
> > > > > > 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:
> > > > >
> > > > >
> > > > >  > > > > $to = "[EMAIL PROTECTED]";
> > > > > $from = "[EMAIL PROTECTED]";
> > > > > $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
> > > >
> > >
> >
> >
> >


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread Simon Garner

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

> well this is actually what I did tho, I used an $email var and set it too
> $from which I used mail()and it still came out as nobody
>


Can you show us the PHP code you're using please.

Ta





> > From: "W.D." <[EMAIL PROTECTED]>
> >
> > > so there is no way to pull this variable from an email form field?
> > >
> >
> >
> > Eh? Of course, $from can be set by a form field if you want. Or a
> database,
> > or any way you can set a variable. Then pass it to mail(), per my last
> > message.
> >
> >
> >
> >
> > >
> > >
> > > > From: "W.D." <[EMAIL PROTECTED]>
> > > >
> > > > > 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:
> > > >
> > > >
> > > >  > > > $to = "[EMAIL PROTECTED]";
> > > > $from = "[EMAIL PROTECTED]";
> > > > $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
> > >
> >
>
>
>


-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread W.D.

well this is actually what I did tho, I used an $email var and set it too
$from which I used mail()and it still came out as nobody



> From: "W.D." <[EMAIL PROTECTED]>
>
> > so there is no way to pull this variable from an email form field?
> >
>
>
> Eh? Of course, $from can be set by a form field if you want. Or a
database,
> or any way you can set a variable. Then pass it to mail(), per my last
> message.
>
>
>
>
> >
> >
> > > From: "W.D." <[EMAIL PROTECTED]>
> > >
> > > > 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:
> > >
> > >
> > >  > > $to = "[EMAIL PROTECTED]";
> > > $from = "[EMAIL PROTECTED]";
> > > $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
> >
>


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread David Robley

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." <[EMAIL PROTECTED]>
> >
> > > 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:
> >
> >
> >  > $to = "[EMAIL PROTECTED]";
> > $from = "[EMAIL PROTECTED]";
> > $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

-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread Simon Garner

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

> so there is no way to pull this variable from an email form field?
>


Eh? Of course, $from can be set by a form field if you want. Or a database,
or any way you can set a variable. Then pass it to mail(), per my last
message.




>
>
> > From: "W.D." <[EMAIL PROTECTED]>
> >
> > > 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:
> >
> >
> >  > $to = "[EMAIL PROTECTED]";
> > $from = "[EMAIL PROTECTED]";
> > $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
>



-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread W.D.

so there is no way to pull this variable from an email form field?




> From: "W.D." <[EMAIL PROTECTED]>
>
> > 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:
>
>
>  $to = "[EMAIL PROTECTED]";
> $from = "[EMAIL PROTECTED]";
> $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


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]




Re: [PHP] mail prob

2001-02-22 Thread Simon Garner

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

> 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:





http://www.php.net/manual/en/function.mail.php


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]




[PHP] mail prob

2001-02-22 Thread W.D.

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.


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]