Skip to main content
Version: 3.2.0

IMAP email source

Version: 3.2.0 Date: 2026-11-17

Goal: A client can send scanned photos by email and Tower protects each attachment the same way it polls an FTP directory.

Solution: One IMAP connector (imapflow + mailparser). The mailbox is polled on the hourly discover and on demand from the source page. Each matching attachment becomes a task. The last IMAP UID is the cursor, stored like the FTP last-trigger timestamp.

Features:

  • Source type email in YAML and in the workflow wizard (host, user:password, mailbox, sender allowlist, extensions)
  • Default mailbox INBOX, default extensions .jpg .jpeg .png .tif .tiff .pdf
  • Check now on an FTP or email source page, disabled when the source is disconnected or when saved changes are not reloaded yet
  • Pending reload badge when the source is connected but its saved config is not the one Tower is running
  • Hourly discover skips FTP and email sources whose init report has a failed connection entry

Implementation Details:

  • POST /api/v1/config/source/watch with { name } so a source name that contains spaces is not part of the URL
  • Watch refuses with 409 while that source differs from the last reloaded snapshot (pendingSources on GET /ping)
  • First poll (no cursor) only takes unseen mail; later polls take every UID after the cursor, including mail already marked read
  • DataService.isSourceDisconnected is the shared rule used by FTP and email discover

Files Modified:

  • src/protocol/source/email/ - IMAP poll, filters, task queue
  • src/protocol/source/source.service.ts - discover and per-source watch
  • src/protocol/source/ftp/ftp.service.ts - watch count and disconnected skip
  • src/core/data/data.service.ts - shared disconnected check
  • src/app.controller.ts - POST config/source/watch
  • src/config.dto.ts - email fields and watch body
  • src/core/configuration/config.schema.ts - email config validation
  • ui/src/pages/workflows/ - wizard, summary, Check now
  • docs/user/configuration/sources.md - email source (EN and FR)
  • docs/user/configuration/examples.md - email YAML example (EN and FR)

Release fragment: feat-email-source