← Back to infra overview

Mail Relay: IMAP to Gmail

Gmail is retiring POP fetching ("Get mail from other accounts"), so the old setup of pulling an external inbox into Gmail is going away. imap2gmail replaces it with a small long-running container that relays mail over IMAP instead.

Flow

Source IMAP -> read raw message -> append to Gmail -> delete from source -> optional ntfy

Routing rules

Rules are evaluated in a fixed order: removal first, then archive, then spam, then the domain check.

Failure handling

Not the outbound relay

This container handles inbound mail only. Outbound mail from other containers, such as Watchtower notifications, still goes through the internal Postfix relay described on the Docker container strategy page.

Deployment

It runs as a Docker container with a persistent volume for the state file. See the imap2gmail repository for folder names, credentials and the compose example.

Mail addresses, credentials and folder names are not published here.