If postfix is setup as the MTA using its virtual transport to deliver mail to a local mbox file (and handling delivery of outgoing messages), and mailx is the MUA, being used on that same computer for reading and composing messages, can only one of these operations happen at once due to mbox file locking?

If a user is using mailx to read their messages and perhaps reply to or compose a few messages, does this prevent postfix from delivering new messages to the user's mbox file? Does this create a situation where the user might not receive some messages due to the incoming messages being bounced?

What is the process for mbox file locking here? When and where is it happening? I am trying to get a better idea of how this works.

1 Answer 1


You are right, Postfix will lock the mail file during delivery.

The mailbox is locked for exclusive access while delivery is in progress.

Read more about it here

But that doesnt mean that your other incoming mails will bounce. If postfix cant deliver during a try,

Apr 15 14:02:25 server.tld postfix/local[67533]: D8C46C9014D: to=, relay=local, delay=1956, delays=1936/0.01/0/20, dsn=4.2.0, status=deferred (cannot update mailbox /var/spool/mail/user for user user. unable to create lock file /var/spool/mail/user.lock: File exists)

it will keep your mail in deferred queue and retry it later until maximal_queue_lifetime expires. The default maximal_queue_lifetime value is 5 days

  • Thanks for the help. This is good to know. Now, how does the inc command work in mailx, if new messages can't be written to the mailbox while it is running? According to the bsd-mailx manual inc will "Incorporate any new messages that have arrived while mail is being read. The new messages are added to the end of the message list, and the current message is reset to be the first new mail message. This does not renumber the existing message list, nor does it cause any changes made so far to be saved."
    – user981178
    Mar 10, 2014 at 17:13
  • mailx not only access mbox. It can access Maildir and IMAP folders too.
    – clement
    Mar 10, 2014 at 17:43
  • Well, I have seen in the manuals that heirloom-mailx supports Maildir and IMAP -- but as near as I can tell, bsd-mailx does not have those features, yet still has the inc command.
    – user981178
    Mar 10, 2014 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .