PDA

View Full Version : Mail failure - no receiver addresses


zoobie
07-29-2003, 11:23 AM
I've noticed that my test email isn't always sent. Then I checked my mailbox on my host and found 19 notices:

Subject: Mail failure - no recipient addresses
From: "Mail Delivery System" <Mailer-Daemon@server1.host.net>
Date: Sun, July 27, 2003 2:51 am
To: admin@doof.us
Priority: Normal
A message that you sent contained no recipient addresses, and therefore no
delivery could be attempted.

All I'm doing is testing my tell-a-friend which simply posts from a form page to the mailer.php...but, as stated above, it doesn't always post the email recipient's address.

Is there a way to back this up to make sure the users email address variable is always posted into mail($email,$subject,$message,$headers); because it seems to be failing fairly frequently.

Thanks
:confused:

ConfusedOfLife
07-29-2003, 12:10 PM
Are you saying that you're sure that $email is set, but then your mail function fails? Or you wana check it out to see if it's set?! I don't think that the latter is your question, but in case of that, you should use isSet().

zoobie
07-29-2003, 08:56 PM
I'm not sure of anything at this point. I didn't have $_POST["email"] in there.
Will this work properly?

$_POST["email"] = "$email";
mail($email,$subject,$message,$headers);

Thanks

ConfusedOfLife
07-29-2003, 09:57 PM
Why are you putting the $email in $_POST["email"], shouldn't it be vice versa?! I mean you get your post vars from the $_POST super global array, so, you can use it directly. But then it's better that you see if it's not empty (it's set and it's not equal to null), you can do it like:


if ( !empty($_POST["email"]) )
mail($_POST["email"], ........


Why don't you echo out $_POST["email"] b4 using the mail function to get sure that it's really set? Also don't forget to validate the email address and also use strip_slashes on your message, because for each ' mark you'll get something like \' in your message that's pretty annoying!

zoobie
07-29-2003, 10:58 PM
Originally posted by ConfusedOfLife
Why are you putting the $email in $_POST["email"]?

Hell if I know...It's something I saw at phpfreaks.com :D

Ok...I'll use the "if" statement to make sure it's in there. I already have the validation and stripslashes set up for comments.

I guess this is correct then:

$_POST["email"];
mail($_POST["email"],$subject,$message,$headers);

Thankee :rolleyes:

Nightfire
07-29-2003, 11:41 PM
Dunno if this is how it was meant to be done or not, but you don't need the line commented out

// $_POST["email"]; this line's doing nothing
mail($_POST["email"],$subject,$message,$headers);

zoobie
07-29-2003, 11:47 PM
Gotcha...Thanks all :D