Files
autoreg-skills-max/skills/account-validation/references/tonline-imap-provider.md

4.2 KiB

T-Online.de IMAP Provider — Auto-Reg Infrastructure

Email Pool

  • Location: C:\Users\User\Downloads\Telegram Desktop\working_mails.txt
  • Format: [REDACTED-EMAIL]:[REDACTED] (one per line, :` separator)
  • Count: 17,893 emails
  • IMAP: secureimap.t-online.de:993, SSL, ssl_context.check_hostname=False, ssl_context.verify_mode=CERT_NONE

Auto-Reg Project

  • Root: C:\Users\User\Desktop\авторег проект\
  • Backend: backend/main.py — FastAPI on port 8000, uvicorn.run(app, host="0.0.0.0", port=8000)
  • Backend venv: .venv\Scripts\python.exe
  • Start: unset PYTHONPATH && ".venv\Scripts\python.exe" "backend\main.py"
  • Start script: START_AUTOREG.bat (port 8002, but main.py defaults to 8000)
  • DB: backend/account_manager.db (SQLite)
  • API: http://127.0.0.1:8000/api/health, /api/accounts, /api/tasks/register

Key Scripts

Script Purpose
camoufox_ai_autoreg.py Browser-based AI provider registration (Groq, Mistral, DeepSeek, etc.)
chatgpt_reg_imap.py Direct ChatGPT login via IMAP OTP (curl_cffi protocol)
autoreg.py TokenHarbor auto-reg via CDP
full_auto_reg.py xAI/Grok auto-reg via device auth + IMAP OTP
th_gateway_v3.py TokenHarbor gateway
tusk_gateway.py Tusk gateway

T-Online IMAP Provider for Backend

File: backend/providers/mailbox/tonline_imap.py

Implements BaseMailbox with:

  • get_email() → returns next unused email from working_mails.txt
  • wait_for_code(account, keyword, timeout, before_ids, code_pattern) → polls IMAP for OTP
  • get_current_ids(account) → returns current email UIDs

Critical: MAILBOX_FACTORY_REGISTRY

The backend's core/base_mailbox.py has a hardcoded MAILBOX_FACTORY_REGISTRY dict. New providers MUST be added here:

MAILBOX_FACTORY_REGISTRY = {
    ...
    "tonline_imap": _create_tonline,  # ← MUST add
    ...
}

def _create_tonline(extra: dict, proxy: str | None) -> 'BaseMailbox':
    from providers.mailbox.tonline_imap import TOnlineMailbox
    mails_file = (extra or {}).get("mails_file", None)
    return TOnlineMailbox(mails_file=mails_file)

Critical: CURL_CA_BUNDLE

curl_cffi on Windows needs CA bundle path. Set before starting backend:

import certifi
os.environ["CURL_CA_BUNDLE"] = certifi.where()

Critical: IP Check Bypass

backend/platforms/chatgpt/register.py → _check_ip_location() uses cloudflare.com/cdn-cgi/trace. If it fails, patch to return True, "DE".

wait_for_code should search ALL (not UNSEEN) and use targeted FROM search:

status, data = imap.search(None, '(OR FROM "openai" FROM "chatgpt" FROM "noreply")')
if status != "OK" or not data[0]:
    status, data = imap.search(None, "ALL")

Provider Registration via API

PUT /api/provider-settings
{
    "provider_type": "mailbox",
    "provider_key": "tonline_imap",
    "display_name": "T-Online.de IMAP",
    "enabled": true,
    "is_default": true,
    "config": {},
    "auth": {}
}

Create Registration Task

POST /api/tasks/register
{
    "platform": "chatgpt",
    "count": 1,
    "executor_type": "protocol"
}

Pitfalls

  • PYTHONPATH contamination: Bash shell inherits Hermes venv's PYTHONPATH. Always unset PYTHONPATH before running backend scripts.
  • Port 8000 conflicts: Multiple backend instances can bind to port 8000. Kill all before restart: netstat -ano | grep ":8000" → taskkill /F /PID XXXX.
  • DB reset on restart: Backend recreates account_manager.db on restart. Provider settings must be reconfigured via API.
  • Provider not instantiated: Check MAILBOX_FACTORY_REGISTRY has the provider key. The _loaded flag prevents re-scanning modules.
  • OTP emails not arriving at t-online.de: Some services (Groq, Blackbox.ai) block t-online.de. ChatGPT OTPs DO arrive but may be delayed.
  • IMAP search scope: With 39K+ emails in inbox, searching only last 20 misses OTP. Use targeted FROM search or increase to last 50.
  • ChatGPT login flow requires JS: After OTP validation, ChatGPT returns HTML with JS redirect. Protocol-only (HTTP) approach can't complete the login. Browser-based flow (Camoufox) is needed for the final step.