function check($email, $expectedSmtp = null) { $d = new PostmanSmtpDiscovery($email); $smtp = $d->getSmtpServer(); $displaySmtp = $smtp; if ($smtp == $expectedSmtp) { print '.'; return true; } else { print sprintf("\n%s: %s smtp=%s\n", 'Fail', $email, $displaySmtp); return false; } }
/** * This Ajax function retrieves the smtp hostname for a give e-mail address */ function getAjaxHostnameByEmail() { $goDaddyHostDetected = $this->getBooleanRequestParameter('go_daddy'); $email = $this->getRequestParameter('email'); $d = new PostmanSmtpDiscovery($email); $smtp = $d->getSmtpServer(); $this->logger->debug('given email ' . $email . ', smtp server is ' . $smtp); $this->logger->trace($d); if ($goDaddyHostDetected && !$d->isGoogle) { // override with the GoDaddy SMTP server $smtp = 'relay-hosting.secureserver.net'; $this->logger->debug('detected GoDaddy SMTP server, smtp server is ' . $smtp); } $response = array('hostname' => $smtp, self::IS_GOOGLE_PARAMETER => $d->isGoogle, 'is_go_daddy' => $d->isGoDaddy, 'is_well_known' => $d->isWellKnownDomain); $this->logger->trace($response); wp_send_json_success($response); }