|
|
|
Next: configuring IIS for PHP5
|
| Author |
Message |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 1) Posted: Mon Aug 06, 2007 6:13 pm
Post subject: help with email form Archived from groups: comp>lang>php (more info?)
|
|
|
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.DeleteThis@fearofdolls.com";
mail($to,$subject,"".$message,$head);
header("Location:thankyou.html");
?> |
|
| Back to top |
|
 |  |
External

Since: Aug 06, 2007 Posts: 7
|
(Msg. 2) Posted: Mon Aug 06, 2007 7:15 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 10:13 pm, alice <al... RemoveThis @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... RemoveThis @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. |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 3) Posted: Mon Aug 06, 2007 7:15 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld....TakeThisOut@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....TakeThisOut@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);
? |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 4) Posted: Mon Aug 06, 2007 7:18 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld... DeleteThis @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... DeleteThis @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. |
|
| Back to top |
|
 |  |
External

Since: Aug 06, 2007 Posts: 7
|
(Msg. 5) Posted: Mon Aug 06, 2007 7:19 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 11:15 pm, alice <al... DeleteThis @fearofdolls.com> wrote:
> On Aug 6, 7:03 pm, Geoff Muldoon <geoff.muld... DeleteThis @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... DeleteThis @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 |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 6) Posted: Mon Aug 06, 2007 7:22 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 7:15 pm, Loki25 <kgarnet....RemoveThis@gmail.com> wrote:
> On Aug 6, 10:13 pm, alice <al....RemoveThis@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....RemoveThis@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? |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 7) Posted: Mon Aug 06, 2007 7:25 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
>
> I'd recommend you use mail($to,$subject,$message,$head); instead- Hide quoted text -
>
> - Show quoted text -
That still isn't working. |
|
| Back to top |
|
 |  |
External

Since: Aug 06, 2007 Posts: 7
|
(Msg. 8) Posted: Mon Aug 06, 2007 7:30 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 11:25 pm, alice <al....TakeThisOut@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. |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 9) Posted: Mon Aug 06, 2007 7:34 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 7:30 pm, Loki25 <kgarnet....TakeThisOut@gmail.com> wrote:
> On Aug 6, 11:25 pm, alice <al....TakeThisOut@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. |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 10) Posted: Mon Aug 06, 2007 7:35 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 7:30 pm, Loki25 <kgarnet....DeleteThis@gmail.com> wrote:
> On Aug 6, 11:25 pm, alice <al....DeleteThis@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.
Could it be something wrong in the html?
<form action="mail.php" method="post"
onsubmit="MM_validateForm('email','','RisEmail');MM_validateForm('message','','R');return
document.MM_returnValue">
<p><label>Your email address:</label><br />
<input name="email" id="email" type="text" class="form" value=""
size="30" />
</p>
<p><label>Your message:</label><br />
<textarea name="message" id="message" value="message" cols="60"
rows="5" class="form"></textarea>
</p>
<input type="submit" name="submit" value="SEND" /> |
|
| Back to top |
|
 |  |
External

Since: Aug 06, 2007 Posts: 7
|
(Msg. 11) Posted: Mon Aug 06, 2007 11:43 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
Your html looks fine, your php looks fine and since you are using a
hosting service, we can assume your settings are fine. I also tested
the PHP script on my own server just to be sure nothing was over
looked. I replaced the $to address and it worked fine for me. Since
the exact code works fine on my server it leads me to believe that the
problem isn't in the code and it is instead on the server side. It
could be something as simple as their SMTP server being down for a
short while. |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2006 Posts: 68
|
(Msg. 12) Posted: Tue Aug 07, 2007 12:03 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
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.RemoveThis@fearofdolls.com";
> mail($to,$subject,"".$message,$head);
^^^^
dot not comma?
> header("Location:thankyou.html");
> ?>
>
> |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2007 Posts: 34
|
(Msg. 13) Posted: Tue Aug 07, 2007 5:25 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
On Aug 6, 11:43 pm, Loki25 <kgarnet... RemoveThis @gmail.com> wrote:
> Your html looks fine, your php looks fine and since you are using a
> hosting service, we can assume your settings are fine. I also tested
> the PHP script on my own server just to be sure nothing was over
> looked. I replaced the $to address and it worked fine for me. Since
> the exact code works fine on my server it leads me to believe that the
> problem isn't in the code and it is instead on the server side. It
> could be something as simple as their SMTP server being down for a
> short while.
I finally got the mail to send, but now whatever I enter in the
message window does not get sent. |
|
| Back to top |
|
 |  |
External

Since: Jul 08, 2004 Posts: 3787
|
(Msg. 14) Posted: Tue Aug 07, 2007 9:20 pm
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
alice wrote:
> On Aug 6, 11:43 pm, Loki25 <kgarnet... DeleteThis @gmail.com> wrote:
>> Your html looks fine, your php looks fine and since you are using a
>> hosting service, we can assume your settings are fine. I also tested
>> the PHP script on my own server just to be sure nothing was over
>> looked. I replaced the $to address and it worked fine for me. Since
>> the exact code works fine on my server it leads me to believe that the
>> problem isn't in the code and it is instead on the server side. It
>> could be something as simple as their SMTP server being down for a
>> short while.
>
> I finally got the mail to send, but now whatever I enter in the
> message window does not get sent.
>
What's your current code, and what is in the variables you are passing
the mail() function?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex DeleteThis @attglobal.net
================== |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2006 Posts: 68
|
(Msg. 15) Posted: Wed Aug 08, 2007 11:16 am
Post subject: Re: help with email form Archived from groups: per prev. post (more info?)
|
|
|
In article <1186532720.113030.138210.DeleteThis@e9g2000prf.googlegroups.com>, alice
says...
> On Aug 6, 11:43 pm, Loki25 <kgarnet....DeleteThis@gmail.com> wrote:
> > Your html looks fine, your php looks fine and since you are using a
> > hosting service, we can assume your settings are fine. I also tested
> > the PHP script on my own server just to be sure nothing was over
> > looked. I replaced the $to address and it worked fine for me. Since
> > the exact code works fine on my server it leads me to believe that the
> > problem isn't in the code and it is instead on the server side. It
> > could be something as simple as their SMTP server being down for a
> > short while.
>
> I finally got the mail to send, but now whatever I enter in the
> message window does not get sent.
>
>
Are you using $message or $_POST['message']?
GM |
|
| Back to top |
|
 |  |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|