Outbound emails are routed through a dispatch table that determines both the delivery method and the target address.
There are three ways an email can arrive in the john mailbox on webdav.critchley.biz:1. SMTP → Postfix → local delivery — Standard inbound mail. Postfix receives via SMTP and delivers to the local maildir. Thunderbird (via IMAP) and Envoy (via imap_client.py) read from here.2. WebDAV write from Envoy — webdav_deliver.py constructs a full .eml (with headers) and uploads it directly to the maildir new/ folder via WebDAV. Used for outbound replies to recipients whose mail servers block SMTP from this host (e.g. Hotmail, Swisscom/bluewin). The recipient sees it in Thunderbird as a normal email.3. WebDAV write from popit3 — mailspool.py in popit3 delivers processed emails the same way. Uses the same WebDAV endpoint but different filename patterns (8-char CRC32 hex vs Envoy's E- prefix).
The dispatch table EMAIL_DISPATCH in orchestrator.py maps cleaned email addresses to (delivery_function, target_address) tuples. When send_email() is called, resolve_delivery() cleans the address (using email.utils.parseaddr) and looks it up. If not found, the default is (deliver_via_mail, same_address).
deliver_via_mail — Sends via the mail command on localhost. The mail goes through Postfix and out via SMTP. Used for recipients with no delivery issues.WebDAVDelivery.deliver — Writes .eml files directly to the WebDAV maildir (webdav.critchley.biz/mail/john/new/). Bypasses SMTP entirely. The WebDAVDelivery class is in webdav_deliver.py; it uses webdav4.client, credentials from ~/.netrc, and generates unique filenames with an 'E' prefix to avoid clashes with popit3's CRC32 filenames.
• john.critchley@bluewin.ch → WebDAVDelivery.deliver (Swisscom blocks SMTP from this host)• jsr_critchley@hotmail.com → WebDAVDelivery.deliver (Hotmail blocks SMTP from this host)• All others → deliver_via_mail to same address (default)
Add entries to EMAIL_DISPATCH in orchestrator.py. Keys are bare email addresses. Values are (delivery_function, target_address) tuples. For WebDAV delivery, use _webdav_delivery.deliver. For mail command delivery, use deliver_via_mail.
• resolve_delivery(raw) — Returns (delivery_fn, target_address) for a raw email address• map_email_address(raw) — Returns just the target address (used for reply-dedup comparisons in execute_actions)