I am using postfix with maildir format. The filenames of messages stored in maildir look something like this:


I understand the first part is epoch time, not sure about the rest. But I would like to have some human friendlier name, such as


I need to manipulate the individual messages/files often (this is the reason why I am using maildir in the first place). Having some more descriptive filename would help.

Can I set this in postfix?

  • What program is doing the actual mail delivery (e.g. procmail)? That is probably where you need to look rather than the MTA.
    – casey
    Dec 18, 2013 at 14:43
  • AFAIU, postfix is doing the actual mail delivery to my maildir folder. Dec 18, 2013 at 14:58

4 Answers 4


No, Postfix has no way to configure this. As @HBruijn said, the Maildir format is a specification and it would be quite an effort to make the LDA and the MUA both agree on a different format. That said, if you don't like the filenames in your maildir, you could beautify them a bit when you look them up:

$ ls | head -1

$ ls | head -1 | perl -pe 's/(\d+)/localtime($1)/e'
Mon Jan  2 03:39:04 2012.27745_1.beta,S=10662:2,S

The original specification of the Maildir format would be good start to answer your question.

The requirement is that each new message will be stored with a unique name.

Unless you're writing messages to a maildir, the format of a unique name is none of your business.

A unique name can be anything that doesn't contain a colon (or slash) and doesn't start with a dot. Do not try to extract information from unique names.

Okay, so you're writing messages. A unique name has three pieces, separated by dots. On the left is the result of time() or the second counter from gettimeofday(). On the right is the result of gethostname(). (To deal with invalid host names, replace / with \057 and : with \072.) In the middle is a delivery identifier, discussed below.


Old-fashioned delivery identifiers use the following formats for the delivery identifier: :

  • n, where n is the process ID, and where this process has been forked to make one delivery. Unfortunately, some foolish operating systems repeat process IDs quickly, breaking the standard time+pid combination.
  • n_m, where n is the process ID and m is the number of deliveries made by this process.

Now the second part of your question, simply put the unique filename is not something that you can configure, unless you go and modify the source code of the local delivery agent.

A work-around would be .forward and pipe the email to script that will store the message with filenames to your liking, essentially creating your own local delivery agent. That should be fairly trivial.

  • that is very nice, but how can I configure postfix to use my format? Dec 18, 2013 at 15:44
  • add .forward with | /home/vegterm/bin/storemail which is a script that takes the mail message as STDIN and creates filenames to your liking in your Maildir.
    – HBruijn
    Dec 18, 2013 at 16:16
  • 1
    +1 and the OP should really rethink on why he wants this so badly. it's like asking for "random numbers but they must start with 3"
    – umläute
    Jan 23, 2014 at 14:09

if you "need to manipulate the individual messages/files often" then you might consider writing a script that helps with manipulating them.

as a side-effect your script might expose a human-readable interface to the actual filenames. something like:

dowithmails rm --from 2014-01-12  --to 2014-01-15
  • what's the reason for the downvote? while this does not answer the question directly, it provides a hint to solve the underlying problem.
    – umläute
    Dec 13, 2016 at 14:48

When you use pop3 and Maildir will contain one large text file.Because all incoming messages stored in one large file. When you use imap and Maildir will contain many small text file.Because each incoming message stored in seperate text file.

  • 1
    POP3 and IMAP are protocols used to access the messages. They do not govern how those messages are stored to disk on the mail server. In fact, the same mail server will often be accessible via both POP3 and IMAP, so it is obviously impossible for the storage format to depend on which access protocol is in use.
    – Kevin
    Jun 24, 2017 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.