How to execute a function until it succeeds?
Posted
by Starx
on Stack Overflow
See other posts from Stack Overflow
or by Starx
Published on 2010-05-18T07:13:32Z
Indexed on
2010/05/18
7:20 UTC
Read the original article
Hit count: 210
I am writing a function to send a mail to specific user?
What I am trying to do is, if error occurs I want to keep on sending the mail until the mail is sent.
function sendmail() {
$name = mysql_escape_string($name);
$email = mysql_escape_string($email);
$phone = mysql_escape_string($phone);
$content = nl2br(mysql_escape_string($content));
$subject = "mail from ".$name." (".$email.", Ph: ".$phone.")";
$mail = @mail($feedback,$subject,$content,$headers);
if($mail) { echo "Your mailis send"; }
else { echo "We are sorry for the inconvienience, but we could not send your mailnow."; }
}
the above function displays error message but instead of giving the error, I want to try to send the mail until the mail is finally sent.
© Stack Overflow or respective owner