2

I need to have postfix store mail in a maildir in /var/mail/<DOMAIN>/<USER>. I've got

mail_spool_directory = /var/mail

and I'm preparing

home_mailbox = 

but I don't know where to go from there.

Assistance please?

EDIT: SF ate my tag. Please re-read to determine paths.

  • Should I assume the < DOMAIN > will be variable (not a hard coded)? – user1797 May 11 '09 at 18:29
  • Correct. Otherwise, this would be easy :) – Glen Solsberry May 11 '09 at 18:35
  • All right. Deleting my answer, as it isn't precisely what you are asking. – user1797 May 11 '09 at 18:41
  • Are you using Procmail as the delivery agent? – user1797 May 11 '09 at 18:44
  • Not yet. Haven't gotten that far :) – Glen Solsberry May 11 '09 at 19:10
3

It sounds like you want Vritual mailbox delivery. This is well-documented at the Postfix website, and will do exactly what you are asking. Note that you will need to do some lookup tables for this, although the official docs do mention that you can use a SQL backend at some point, should it all become too unmanageable.

2

The only way I can think of to accomplish what you want is the using Procmail (or alike with similar capabilities) as the delivery agent. With procmail, something like this on the system wide procmailrc would work:

:0
* RECIPIENT ?? .*@\/.*$
{ DOMAIN = "$MATCH" }
MAILDIR="/var/mail/$DOMAIN/$USER"
DEFAULT="$MAILDIR/"
  • As there are other MTAs that may use Procmail in a similar fashion, +1 for MTA-agnostic answer... :) – Avery Payne May 12 '09 at 3:55

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.