help with email form

This is a discussion on help with email form within the PHP Language forums, part of the PHP Programming Forums category; Can anyone tell me why this code won't work? I've saved it as mail.php, and have a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default help with email form

Can anyone tell me why this code won't work?
I've saved it as mail.php, and have a form on a web page with
action="mail.php" in the html. I've gotten this to work before on
other pages I've worked on, I can't figure out why it's not working
today, I must have forgotten something. The thank you page comes up,
but the mail is not actually delivered.

<?php
$to="greg@fearofdolls.com";
$subject="Fear of Dolls web email";
$email=$_POST["email"];

$message="From Fear of Dolls web email\n";
$message.="message: ".$message."\n";

$head="From: fear@fearofdolls.com";
mail($to,$subject,"".$message,$head);
header("Location:thankyou.html");
?>

Reply With Quote
  #2 (permalink)  
Old 08-07-2007
Geoff Muldoon
 
Posts: n/a
Default Re: help with email form

alice says...
> Can anyone tell me why this code won't work?
> I've saved it as mail.php, and have a form on a web page with
> action="mail.php" in the html. I've gotten this to work before on
> other pages I've worked on, I can't figure out why it's not working
> today, I must have forgotten something. The thank you page comes up,
> but the mail is not actually delivered.
>
> <?php
> $to="greg@fearofdolls.com";
> $subject="Fear of Dolls web email";
> $email=$_POST["email"];
>
> $message="From Fear of Dolls web email\n";
> $message.="message: ".$message."\n";
>
> $head="From: fear@fearofdolls.com";
> mail($to,$subject,"".$message,$head);

^^^^
dot not comma?

> header("Location:thankyou.html");
> ?>
>
>

Reply With Quote
  #3 (permalink)  
Old 08-07-2007
Loki25
 
Posts: n/a
Default Re: help with email form

On Aug 6, 10:13 pm, alice <al...@fearofdolls.com> wrote:
> Can anyone tell me why this code won't work?
> I've saved it as mail.php, and have a form on a web page with
> action="mail.php" in the html. I've gotten this to work before on
> other pages I've worked on, I can't figure out why it's not working
> today, I must have forgotten something. The thank you page comes up,
> but the mail is not actually delivered.
>
> <?php
> $to="g...@fearofdolls.com";
> $subject="Fear of Dolls web email";
> $email=$_POST["email"];
>
> $message="From Fear of Dolls web email\n";
> $message.="message: ".$message."\n";
>
> $head="From: f...@fearofdolls.com";
> mail($to,$subject,"".$message,$head);
> header("Location:thankyou.html");
> ?>


I can't see any reason why it wouldn't work, are you getting an error
message? if not, then the code is probably working and your problem is
that the SMTP server isn't properly set in your configurations.

Reply With Quote
  #4 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default Re: help with email form

On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld...@trap.gmail.com> wrote:
> alice says...
>
>
>
> > Can anyone tell me why this code won't work?
> > I've saved it as mail.php, and have a form on a web page with
> > action="mail.php" in the html. I've gotten this to work before on
> > other pages I've worked on, I can't figure out why it's not working
> > today, I must have forgotten something. The thank you page comes up,
> > but the mail is not actually delivered.

>
> > <?php
> > $to="g...@fearofdolls.com";
> > $subject="Fear of Dolls web email";
> > $email=$_POST["email"];

>
> > $message="From Fear of Dolls web email\n";
> > $message.="message: ".$message."\n";

>
> > $head="From: f...@fearofdolls.com";
> > mail($to,$subject,"".$message,$head);

>
> ^^^^
> dot not comma?
>
>
>
> > header("Location:thankyou.html");
> > ?>- Hide quoted text -

>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


So it should be mail($to,$subject,"",$message,$head);
?

Reply With Quote
  #5 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default Re: help with email form

On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld...@trap.gmail.com> wrote:
> alice says...
>
>
>
> > Can anyone tell me why this code won't work?
> > I've saved it as mail.php, and have a form on a web page with
> > action="mail.php" in the html. I've gotten this to work before on
> > other pages I've worked on, I can't figure out why it's not working
> > today, I must have forgotten something. The thank you page comes up,
> > but the mail is not actually delivered.

>
> > <?php
> > $to="g...@fearofdolls.com";
> > $subject="Fear of Dolls web email";
> > $email=$_POST["email"];

>
> > $message="From Fear of Dolls web email\n";
> > $message.="message: ".$message."\n";

>
> > $head="From: f...@fearofdolls.com";
> > mail($to,$subject,"".$message,$head);

>
> ^^^^
> dot not comma?
>
>
>
> > header("Location:thankyou.html");
> > ?>- Hide quoted text -

>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


Well, doing that made something different happen...I got a message
from my ISPs proxy email relay, but not the content of the message I
mailed in the form.

Reply With Quote
  #6 (permalink)  
Old 08-07-2007
Loki25
 
Posts: n/a
Default Re: help with email form

On Aug 6, 11:15 pm, alice <al...@fearofdolls.com> wrote:
> On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld...@trap.gmail.com> wrote:
>
>
>
> > alice says...

>
> > > Can anyone tell me why this code won't work?
> > > I've saved it as mail.php, and have a form on a web page with
> > > action="mail.php" in the html. I've gotten this to work before on
> > > other pages I've worked on, I can't figure out why it's not working
> > > today, I must have forgotten something. The thank you page comes up,
> > > but the mail is not actually delivered.

>
> > > <?php
> > > $to="g...@fearofdolls.com";
> > > $subject="Fear of Dolls web email";
> > > $email=$_POST["email"];

>
> > > $message="From Fear of Dolls web email\n";
> > > $message.="message: ".$message."\n";

>
> > > $head="From: f...@fearofdolls.com";
> > > mail($to,$subject,"".$message,$head);

>
> > ^^^^
> > dot not comma?

>
> > > header("Location:thankyou.html");
> > > ?>- Hide quoted text -

>
> > - Show quoted text -- Hide quoted text -

>
> > - Show quoted text -

>
> So it should be mail($to,$subject,"",$message,$head);
> ?


No

The signature of PHP's mail function is:
bool mail ( string $to, string $subject, string $message [, string
$additional_headers [, string $additional_parameters]] )

meaning that if you use: mail($to,$subject,"",$message,$head) then
what will happen is PHP will consider $message to be your headers and
if it does work, it will just send a blank email because you are
passing "" as the message

I'd recommend you use mail($to,$subject,$message,$head); instead

Reply With Quote
  #7 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default Re: help with email form

On Aug 6, 7:15 pm, Loki25 <kgarnet...@gmail.com> wrote:
> On Aug 6, 10:13 pm, alice <al...@fearofdolls.com> wrote:
>
>
>
>
>
> > Can anyone tell me why this code won't work?
> > I've saved it as mail.php, and have a form on a web page with
> > action="mail.php" in the html. I've gotten this to work before on
> > other pages I've worked on, I can't figure out why it's not working
> > today, I must have forgotten something. The thank you page comes up,
> > but the mail is not actually delivered.

>
> > <?php
> > $to="g...@fearofdolls.com";
> > $subject="Fear of Dolls web email";
> > $email=$_POST["email"];

>
> > $message="From Fear of Dolls web email\n";
> > $message.="message: ".$message."\n";

>
> > $head="From: f...@fearofdolls.com";
> > mail($to,$subject,"".$message,$head);
> > header("Location:thankyou.html");
> > ?>

>
> I can't see any reason why it wouldn't work, are you getting an error
> message? if not, then the code is probably working and your problem is
> that the SMTP server isn't properly set in your configurations.- Hide quoted text -
>
> - Show quoted text -


Not getting any error messages. Where are the configurations that you
speak of?

Reply With Quote
  #8 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default Re: help with email form


>
> I'd recommend you use mail($to,$subject,$message,$head); instead- Hide quoted text -
>
> - Show quoted text -


That still isn't working.

Reply With Quote
  #9 (permalink)  
Old 08-07-2007
Loki25
 
Posts: n/a
Default Re: help with email form

On Aug 6, 11:25 pm, alice <al...@fearofdolls.com> wrote:
> > I'd recommend you use mail($to,$subject,$message,$head); instead- Hide quoted text -

>
> > - Show quoted text -

>
> That still isn't working.


If you are running your own server, find your php.ini file and open it
up. look for do a search for the SMTP section (using your editor's
find command, it should be the first result)...you will see the
mail_function block configuration block...should look something like:

[mail function]
; For Win32 only.
SMTP = <your SMTP server address>

; For Win32 only.
sendmail_from = <your reply email address>

; For Unix only. You may supply arguments as well (default: "sendmail
-t -i").
;sendmail_path =

enter this information if it is not already there, save the file and
restart your web server so the new settings take affect and try it
again.

Reply With Quote
  #10 (permalink)  
Old 08-07-2007
alice
 
Posts: n/a
Default Re: help with email form

On Aug 6, 7:30 pm, Loki25 <kgarnet...@gmail.com> wrote:
> On Aug 6, 11:25 pm, alice <al...@fearofdolls.com> wrote:
>
> > > I'd recommend you use mail($to,$subject,$message,$head); instead- Hide quoted text -

>
> > > - Show quoted text -

>
> > That still isn't working.

>
> If you are running your own server, find your php.ini file and open it
> up. look for do a search for the SMTP section (using your editor's
> find command, it should be the first result)...you will see the
> mail_function block configuration block...should look something like:
>
> [mail function]
> ; For Win32 only.
> SMTP = <your SMTP server address>
>
> ; For Win32 only.
> sendmail_from = <your reply email address>
>
> ; For Unix only. You may supply arguments as well (default: "sendmail
> -t -i").
> ;sendmail_path =
>
> enter this information if it is not already there, save the file and
> restart your web server so the new settings take affect and try it
> again.


I'm not running my own servier, but I guess I'll suggest this to my
ISP. I have had email forms work with this same site/ISP, I'm just
trying to change it slightly, borrowed the code from somewhere where
it seemed to work fine.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0