Re: Newbie getting close, form submission
| From: | Justin French | Date: | Tue, 23 Jul 2002 04:07:00 +0000 |
| Subject: | Re: Newbie getting close, form submission | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109017@lists.php.net to get a copy of this message | ||
I pointed this out to you in my original post:
you mail() call should be:
mail($MailToAddress, $MailSubject, $Message, "From: $MailFromAddress");
not:
mail("$MailToAddress", "$MailSubject", "$Message", "From:
$MailFromAddress");
In other words, I don't think you should wrap plain $vars in double
quotes... it may be the cause of the problem, or it may just slow down PHP a
little when not needed.
For debugging, instead of sending the mail(), just do this:
echo "To: {$MailToAddress}<BR />\n";
echo "Subject: {$MailSubject}<BR />\n";
echo "Message: {$Message}<BR />\n";
echo "From: {$MailFromAddress}<BR />\n";
In otherwords, you should be looking to see if each $var you're sending to
the mail() function IS WHAT YOU EXPECT, once you're sure they're correct,
THEN you can pipe them back into a mail() call, and test.
Possibly mail() is not working on the server at all. A great way to test
that would be to create a SEPARATE SCRIPT which just has this:
<?
$to = 'me@my.com';
$sub = 'really simple test';
$msg = 'testing, testing\n\ntestingtesting';
$header = 'From: me@my.com';
mail($to, $sub, $msg, $header);
?>
The reason for creating a separate script is to ensure that you're only
testing the mail() function, not anything else.
You could also try turning your error reporting on to a higher level, which
may indicate the bug.
Justin
on 22/07/02 11:42 PM, Dean Ouellette (dean@ouellette.ws) wrote:
> I am a complete newbie, search the web for examples right now and use
> them.
>
> The host has php 3.0
>
> Having problems with for submission
> Right now, no error messages, but does not actually send the email.
> Ideas?
>
> <?
> $MailToAddress = "email@myaddress.com";
>
> $MailSubject = "Get Involved List";
>
> if (!$MailFromAddress)
>
> {
> $MailFromAddress = "$email";
> }
>
> $Header = "";
> $Footer = "";
> ?>
>
> <?
>
> if (!is_array($HTTP_POST_VARS))
>
> return;
>
> reset($HTTP_POST_VARS);
>
> while(list($key, $val) = each($HTTP_POST_VARS))
>
> {
> $GLOBALS[$key] = $val;
>
> $val=stripslashes($val);
>
> $Message .= "$key = $val\n";
> }
>
> if ($Header)
> {
> $Message = $Header."\n\n".$Message;
> }
>
> if ($Footer)
>
> {
> $Message .= "\n\n".$Footer;
> }
>
> mail( "$MailToAddress", "$MailSubject", "$Message", "From:
> $MailFromAddress");
>
> ?>
>