PDA

View Full Version : What am I doing wrong?


Jacob Stetser
03-04-1999, 02:03 AM
http://www.icongarden.com/phpmail.phps

Does anyone see anything particularly obviously wrong with this script? It's just returning

"error"

with no explanation, whether or not the email is really valid or not.

Any ideas?

Jake

Justin
03-04-1999, 04:47 AM
I'm not totally sure, but looking at it, it seems like it's executing the last function:

$from_email_array=validateEmail ( $from_email_address );

//
//Second, test the results and send the message or display
//an error
//
if (( $to_email_array[0]) && ($from_email_array[0])) {

send_mail($to_email_address, $from_email_address, $subject, $message);

} else {

//DISPLAY AN ERROR

echo "error";
echo $to_email_array[1];
echo $from_email_array[1];
}

So I'm guessing something is calling that function without the proper arguments. I can't say for sure, just looks that way - it's echoing "error" and nothing else - no email arrays. So I'm guessing they're empty - where is the script that calls this one?


------------------
Justin Nelson, SFE Software
www.vdj.net (http://www.vdj.net)

stan
03-04-1999, 11:49 AM
This validateEmail function validates the email address really good.

It actually finds the SMTP host, opens a connection and executes the SMTP protocol, submitting TO and FROM address up to the point the message would be delivered and stops there.

My guess would be that you forgot the call validateEmail for the TO address, so the
$to_email_array[0] is never set (and thus false).

Add at least this:

$to_email_array=validateEmail($to_email_address);


Where $to_email_address is set with a value from the POST operation.

Don't forget to set $SERVER_NAME to the name of the machine that executes the script.

Stan


------------------
Stan P. van de Burgt stan@dmo.com (PGP 0x853296C5)
DMO, P.O. box 1248, 3500 BE, Utrecht, the Netherlands