function connectAndVerify($email) { $expEmail = explode('@', $email); $mxRecords = $this->getMXRecords($expEmail[1]); if (empty($mxRecords)) { Script::responseErrorAndExit(ErrorScript::MX_EMPTY); } $res = false; $id = 0; foreach ($mxRecords as $mxRecord) { $this->logID = 'Attempt' . $id++; $res = $this->checkServer($mxRecord); if ($res) { if ($this->verifyEmail($email) === ErrorScript::RE_TRY) { continue; } break; } else { break; } } return $res; }