Checking if Email address is deliverable \r\n"); $youok = fgets($connection, 512); if($youok){ $state = "chatting to $mailserver: $youok"; fputs($connection, "RCPT TO: <$newaddress>\r\n"); $recepient = fgets($connection, 512); $state = "chatting to $mailserver: $recepient"; if(ereg('250',$recepient)){ fputs($connection, "QUIT\r\n"); $deliverable = true; $state = false; }elseif(ereg('220',$recepient)){ fputs($connection, "QUIT\r\n"); $deliverable = true; $state = false; }else{ $deliverable = false; $state = "RCPT? $recepient $newaddress"; } } }else{ $state = "$mailserver not accepting mail now, please try again."; } //}else{ //$state = 'mailserver not greeting me'; //break; //} }else{ $state = "$mailserver not listening"; } return $state; } ?>