SearchSearch   

help with email form

 
Goto page Previous  1, 2
   Webmaster Forums (Home) -> PHP RSS
Next:  configuring IIS for PHP5  
Author Message
alice

External


Since: Jul 21, 2007
Posts: 34



(Msg. 16) Posted: Thu Aug 09, 2007 9:07 am
Post subject: Re: help with email form
Archived from groups: comp>lang>php (more info?)

On Aug 7, 6:16 pm, Geoff Muldoon <geoff.muld....RemoveThis@trap.gmail.com> wrote:
> In article <1186532720.113030.138....RemoveThis@e9g2000prf.googlegroups.com>, alice
> says...> 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.
>
> Are you using $message or $_POST['message']?
>
> GM

I'm not in front of it now, but I can see from my earlier post that
I'm using
$message.="message: ".$message."\n";

So should this be
$message.="message: "$_POST['message']"\n";

or, I'm guessing here, if I don't want the word Message: to be in the
email body it would be
$message.=$_POST['message']"\n";
Back to top
Loki25

External


Since: Aug 06, 2007
Posts: 7



(Msg. 17) Posted: Fri Aug 10, 2007 9:25 am
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

On Aug 9, 1:07 pm, alice <al... RemoveThis @fearofdolls.com> wrote:
> On Aug 7, 6:16 pm, Geoff Muldoon <geoff.muld... RemoveThis @trap.gmail.com> wrote:
>
>
>
> > In article <1186532720.113030.138... RemoveThis @e9g2000prf.googlegroups.com>, alice
> > says...> 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.
>
> > Are you using $message or $_POST['message']?
>
> > GM
>
> I'm not in front of it now, but I can see from my earlier post that
> I'm using
> $message.="message: ".$message."\n";
>
> So should this be
> $message.="message: "$_POST['message']"\n";
>
> or, I'm guessing here, if I don't want the word Message: to be in the
> email body it would be
> $message.=$_POST['message']"\n";

if you were to do it that way, it would be: $message.=
$_POST['message']."\n"; (you were missing the [.])
Back to top
alice

External


Since: Jul 21, 2007
Posts: 34



(Msg. 18) Posted: Sun Aug 12, 2007 11:29 am
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

On Aug 10, 9:25 am, Loki25 <kgarnet... RemoveThis @gmail.com> wrote:
> On Aug 9, 1:07 pm, alice <al... RemoveThis @fearofdolls.com> wrote:
>
>
>
>
>
> > On Aug 7, 6:16 pm, Geoff Muldoon <geoff.muld... RemoveThis @trap.gmail.com> wrote:
>
> > > In article <1186532720.113030.138... RemoveThis @e9g2000prf.googlegroups.com>, alice
> > > says...> 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.
>
> > > Are you using $message or $_POST['message']?
>
> > > GM
>
> > I'm not in front of it now, but I can see from my earlier post that
> > I'm using
> > $message.="message: ".$message."\n";
>
> > So should this be
> > $message.="message: "$_POST['message']"\n";
>
> > or, I'm guessing here, if I don't want the word Message: to be in the
> > email body it would be
> > $message.=$_POST['message']"\n";
>
> if you were to do it that way, it would be: $message.=
> $_POST['message']."\n"; (you were missing the [.])- Hide quoted text -
>
> - Show quoted text -

Now I'm getting a blank page after clicking submit, and no mail is
showing up. Here is the mail.php code, with the address x'd out.
<?php
$to="x@xxxxxx";
$subject="web email";
$email=$_POST["email"];

$message="web email\n";
$message=.$_POST['message']."\n";


$head="From: x@xxxxx";
mail($to,$subject,"".$message,$head);
header("Location:thankyou.html");
?>
Back to top
Loki25

External


Since: Aug 06, 2007
Posts: 7



(Msg. 19) Posted: Mon Aug 13, 2007 12:56 am
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

On Aug 12, 3:29 pm, alice <al....TakeThisOut@fearofdolls.com> wrote:
> On Aug 10, 9:25 am, Loki25 <kgarnet....TakeThisOut@gmail.com> wrote:
>
>
>
> > On Aug 9, 1:07 pm, alice <al....TakeThisOut@fearofdolls.com> wrote:
>
> > > On Aug 7, 6:16 pm, Geoff Muldoon <geoff.muld....TakeThisOut@trap.gmail.com> wrote:
>
> > > > In article <1186532720.113030.138....TakeThisOut@e9g2000prf.googlegroups.com>, alice
> > > > says...> On Aug 6, 11:43 pm, Loki25 <kgarnet....TakeThisOut@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
>
> > > I'm not in front of it now, but I can see from my earlier post that
> > > I'm using
> > > $message.="message: ".$message."\n";
>
> > > So should this be
> > > $message.="message: "$_POST['message']"\n";
>
> > > or, I'm guessing here, if I don't want the word Message: to be in the
> > > email body it would be
> > > $message.=$_POST['message']"\n";
>
> > if you were to do it that way, it would be: $message.=
> > $_POST['message']."\n"; (you were missing the [.])- Hide quoted text -
>
> > - Show quoted text -
>
> Now I'm getting a blank page after clicking submit, and no mail is
> showing up. Here is the mail.php code, with the address x'd out.
> <?php
> $to="x@xxxxxx";
> $subject="web email";
> $email=$_POST["email"];
>
> $message="web email\n";
> $message=.$_POST['message']."\n";
>
> $head="From: x@xxxxx";
> mail($to,$subject,"".$message,$head);
> header("Location:thankyou.html");
> ?>

Everything looks fine to me, I don't see anything wrong with your
code. But what I'm trying to figure out is the purpose of the empty
quotes just before the message in the mail function call. ("".$message)
Back to top
Tim Ferguson

External


Since: Jul 23, 2007
Posts: 5



(Msg. 20) Posted: Tue Aug 14, 2007 5:13 pm
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

Loki25 <kgarnett24.TakeThisOut@gmail.com> wrote in news:1186991766.268471.180630
@o61g2000hsh.googlegroups.com:

>> $message="web email\n";
>> $message=.$_POST['message']."\n";
>>
>

I think this should be

$message .= $_POST['message']."\n";


since the operator is .= not =.

Tim F
Back to top
Loki25

External


Since: Aug 06, 2007
Posts: 7



(Msg. 21) Posted: Wed Aug 15, 2007 11:57 pm
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

On Aug 14, 2:13 pm, Tim Ferguson <Ferguso....RemoveThis@softhome.net> wrote:
> Loki25 <kgarnet....RemoveThis@gmail.com> wrote in news:1186991766.268471.180630
> @o61g2000hsh.googlegroups.com:
>
> >> $message="web email\n";
> >> $message=.$_POST['message']."\n";
>
> I think this should be
>
> $message .= $_POST['message']."\n";
>
> since the operator is .= not =.
>
> Tim F

good catch
Back to top
Tyno Gendo

External


Since: Aug 16, 2007
Posts: 1



(Msg. 22) Posted: Thu Aug 16, 2007 3:04 pm
Post subject: Re: help with email form
Archived from groups: per prev. post (more info?)

alice wrote:
> On Aug 6, 7:15 pm, Loki25 <kgarnet....TakeThisOut@gmail.com> wrote:
>> On Aug 6, 10:13 pm, alice <al....TakeThisOut@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....TakeThisOut@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?
>

Just a note, but you should get a return value from mail() to say
whether it worked or not.

eg:
if ( !mail($to, $subject, $message, $head) ) {
exit("Achk... something not right.");
}

and also something to note, when I write out a header for a redirect
I always encapsulate it in an exit, i've used ti before in code and
found that header() doesn't actually quite your code, so you have
danger of some code after the header being executed... eg.

header( 'Location: offwego.php' );
// next line would execute even though the header redirects
mysql_query("DELETE FROM users WHERE user_id={$user_id}");

PS. Did you get this working? be careful from with From: field, some
server drop mail if the From is invalid.
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> PHP
Goto page Previous  1, 2
Page 2 of 2

 
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