"; fwrite($sock, $msg."\r\n"); $reply = fread($sock, 2082); $msg="RCPT TO: <".$name.'@'.$domain.">"; fwrite($sock, $msg."\r\n"); $reply = fread($sock, 2082); preg_match('/^([0-9]{3}) /ims', $reply, $matches); $code = isset($matches[1]) ? $matches[1] : ''; if($code == '250') { $result=true; }elseif($code == '451' || $code == '452') { $result=true; }else{ $result=false; } $msg="quit"; fwrite($sock, $msg."\r\n"); fclose($sock); } return $result; } function get_spam_score($raw_email) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, 'http://spamcheck.postmarkapp.com/filter'); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('email' => $raw_email,'options'=>'short'))); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $response = curl_exec($ch); if(empty($response) || curl_error($ch) || curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200){ curl_close($ch); return FALSE; } curl_close($ch); $score = json_decode($response); if ($score->success == TRUE AND is_numeric($score->score)) return $score->score; else return FALSE; } ?>