Re: [PHP] Re: newbie form problem

2002-07-25 Thread Analysis Solutions

On Sun, Jul 21, 2002 at 03:50:15PM -0500, Richard Lynch wrote:
 if (!$MailFromAddress) {

 This should probably be:
 
 if (!isset($MailFromAddress) || !$MailFromAddress)){

Or better:

  if ( empty($MailFromAddress) ) {

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: newbie form problem

2002-07-21 Thread Richard Lynch

?
$MailToAddress = [EMAIL PROTECTED];
$MailSubject = Group volunteer  list;
if (!$MailFromAddress) {

This should probably be:

if (!isset($MailFromAddress) || !$MailFromAddress)){

Hard to tell if this is cut out from a bigger script or what...

You also have a very unusual (but at least consistent) indenting style for {
and }...

$MailFromAddress = $email;
}
$Header = ;
$Footer = ;
?
   
 
 ?
if (!is_array($HTTP_POST_VARS))
return;

You may want to use isset() first here as well, and to check for the new
$_POST array.

reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;

It would be better to use $$key = $val instead of stuffing things into
$GLOBALS.

Variable variables are a documented feature.  Assigning stuff into $GLOBALS
is not.
Don't think it will ever really break, but it's always safer to use
documented features.

$val=stripslashes($val);
   
$Message .= $key = $val\n;

To be strictly RFC-compliant, use \r\n, not just \n

}
 
if ($Header) {
$Message = $Header.\n\n.$Message;
}
 
if ($Footer) {
$Message .= \n\n.$Footer;
}
 
mail( $MailToAddress, $MailSubject, $Message, From:
$MailFromAddress);

The quotes on the first three arguments are silly -- not harmful, just
silly.  You're forcing PHP to create another string to hold the strings you
already have.  A trifle wasteful, I suppose, but mostly just silly.

Also use Reply-to: as well as From: if you want maximum number of email
clients to do the right thing.

You should be getting and checking the return value of the mail() function:

$success = mail($MailToAddress, $MailSubject, $Message, From:
$MailFromAddress\r\nReply-to: $MailFromAddress);
if ($success){
  echo Mail successfully queued.BR\n;
}
else{
  echo Unable to queue email.BR\n;
}

This last part may not help you figure out *WHY* the email isn't arriving,
but you can at least pin-point the problem to either *BEFORE* PHP ever gets
the email shoved into sendmail's queue, or after sendmail got the email.

If this prints Unable to queue email you know PHP is not talking nice
enough to sendmail to get the email into sendmail's queue.  If it claims the
email was queued, you need to look at sendmail and see why it has decided
not to send the email after all.

-- 
Like Music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php