Skip to content

⚠ Mail queue doesn't survive reboots ⚠ #1584

@yajo

Description

@yajo

Context

Using the recommended volume configuration won't save your mail queue from restarts:
https://github.com/tomav/docker-mailserver/blob/f225e14a219824e4ebb34e63b144e6d7c1314bcb/docker-compose.yml.dist#L13-L17

What is affected by this bug?

Deferred mails in queue will not be resent after a reboot or container rebuild.

When does this occur?

When some mail gets deferred and queued and, later, you reconfigure your container (quite common for fixing some kind of problem, like a relay password that has changed), the mail queue is lost.

How do we replicate the issue?

  1. Configure with SMTP_ONLY=1 and some DEFAULT_RELAY_HOST that makes the sent mails fail. The failure might be a wrong password or (in the case below) a wrong TLS setting.

  2. Send a mail.

  3. Execute postqueue -p in the container. You'll see an output similar to:

    $ docker-compose exec smtp postqueue -p                                                                                                                                                         
    -Queue ID-  --Size-- ----Arrival Time---- -Sender/Recipient-------                                                                                                                                     
    2F68C223A6C     3701 Tue Aug  4 11:30:32  [email protected]                                                                                                                                          
                (TLS is required, but was not offered by host 10.0.0.1[10.0.0.1])                                                                                                                         
                                            [email protected] 4.
    
  4. Fix the problem.

  5. Rebuild with docker-compose up -d --force-recreate

  6. Execute postqueue -p in the container.

Actual Behavior

The new mail queue will be empty.

Running this command seems to explain why:

$ postconf -p queue_directory
queue_directory = /var/spool/postfix

That's the directory where mail queue is stored, and it's not in any volume.

Expected behavior (i.e. solution)

The queue should be stored under /var/mail-state/spool-postfix. Or /var/spool/postfix should be a recommended mount point. Or maybe even /var/spool? Because this command shows that it's used also somewhere else:

$ postconf -p | grep /spool
queue_directory = /var/spool/postfix
smtpd_sasl_path = /var/spool/postfix/private/auth

Your Environment

  • Amount of RAM available: 8GiB
  • Mailserver version used: If the org.label-schema.vcs-ref label is right, it points to f225e14. In any case, the exact image is sha256:701355354a94a936006df1e7635eec5fff2cedf166c93fb6cffc0663e9ff0e34 downloaded from Docker Hub.
  • Docker version used: Docker version 18.06.1-ce, build e68fc7a
  • Environment settings relevant to the config: Ubuntu 18.04.1 LTS

@Tecnativa TT25079

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions