My mail server hosts email for two different domains which it responds to as physical domains and also handles several virtual emails. Yes, this is insane, but postfix lets me do this.

Recently, I have been trying to add maildrop support to allow me to filter emails on each account as per the recipients needs.

A relevant main.cf excerpt is:

myorigin = /etc/mailname
mydestination = domain1.com, domain2.com, localhost.localdomain, localhost.localdomain, localhost
home_mailbox = Maildir/
maildrop_destination_recipient_limit = 1
mailbox_command = /usr/bin/maildrop -d ${USER}

virtual_mailbox_domains = domain3.com domain4.com
virtual_mailbox_base = /var/mail
virtual_mailbox_maps = hash:/etc/postfix/virtual/maps
virtual_alias_maps = hash:/etc/postfix/virtual/aliases
virtual_minimum_uid = 1000
virtual_uid_maps = static:vmail
virtual_gid_maps = static:vmail
virtual_transport = maildrop

As you've guessed, master.cf contains a maildrop transport:

maildrop  unix  -       n       n       -       -       pipe
  flags=ODRhu user=vmail:vmail argv=/usr/bin/maildrop -w 90 
  -d ${user}@${nexthop}
  ${extension} ${recipient} ${user} ${nexthop}

Now, my problem is that only domain1 receives user lookups successfully. If I email user@domain2.com, maildrop complains:

s_connect() failed: No such file or directory /usr/bin/maildrop: Unable to open mailbox.

and emails to domain3/domain4 complain:

s_connect() failed: No such file or directory Invalid user specified.

Not unsurprisingly, /etc/mailname == domain1.com.

I believe part of my problem might be the master.cf and /etc/maildroprc configurations, so my questions are twofold:

  1. Is there a way to configure these to play nicely with my somewhat convoluted setup?
  2. Is maildrop the tool to use for this, or is there a better MTA which explicitly supports this kind of layout (and if so how do I actually use it)?

Finally, as an aside, if this question is better on serverfault/unix/ubuntu, feel free to move it there.


[virtual domains part]

Replace -d ${user}@${nexthop} by -d ${user}@${domain} in master.cf as recommended in Postfix + Maildrop Howto

As I understand in your configuration ${nexthop} is an empty string so maildrop gets user@

Your Answer

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