I am using Postfix & Dovecot on a VPS (Ubuntu 15.04 64 bits) at OVH in France for a small user base (a big dozen of users, mostly my family, less than a thousand email/day, including spam) for two DNS domains, let's call them starynk.net & melt.org (the actual ones are slightly different, but you could guess them easily). Most of the emails are to starynk.net, and a very few email addresses on melt.org might be aliases to @starynk.net

postfix package is version 2.11.3-1ubuntu1, dovecot-core package is 1:2.2.9-1ubuntu5

I followed carefully the instructions on http://www.binarytides.com/install-postfix-dovecot-debian/ and it works (at last!) because I can send & receive mails on my home Debian Linux PC (which is not the VPS server at OVH) to my address basile@starynk.net

I guess that the significant configuration is in my /etc/postfix/main.cf :

# grep virtual /etc/postfix/main.cf 
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains

with the file /etc/postfix/virtual_mailbox_domains containing:

# file /etc/postfix/virtual_mailbox_domains by Basile
starynk.net OK
melt.org OK

I want to add some alias emails for starynk.net (e.g: john@starynk.net -> john.starynk99@gmail.com ....) and for melt.org (e.g. webmaster@melt.org -> basile@starynk.net)

Of course, editing /etc/aliases then running newaliases does not work.

I guess that I need virtual alias domains so I probably need to add somewhere in /etc/postfix/main.cf (but is the order important there?) a line like

 virtual_alias_domains = starynk.net melt.org
 virtual_alias_maps = hash:/etc/postfix/virtualaliases

(is that correct? is that compatible with the existing settings?)

and finally put in that new /etc/postfix/virtualaliases file lines like

## file /etc/postfix/virtualaliases by Basile
matt@starynk.net: matt.star11@gmail.com
john@starynk.net: john.starynk99@gmail.com
family@starynk.net: matt@starynk.net, john@starynk.net 
webmaster@melt.org: basile@starynk.net

When I run as root postmap /etc/postfix/virtualaliases it looks I am getting warnings for every entry:

postmap: warning: /etc/postfix/virtualaliases, line 2: record is in "key: value" format; is this an alias file?
postmap: warning: /etc/postfix/virtualaliases, line 3: record is in "key: value" format; is this an alias file?
postmap: warning: /etc/postfix/virtualaliases, line 4: record is in "key: value" format; is this an alias file?
postmap: warning: /etc/postfix/virtualaliases, line 5: record is in "key: value" format; is this an alias file?

but then, what is the newaliases command to run after editing the file above? Can it accept pipe notation as documented in Postfix' aliases(5) ?

At last, how to test the configuration of a Postfix system? is there a Postfix command (which I would use to test my new Postfix configuration) explaining what happens to an email to webmaster@melt.org without having to send an actual email ?

not working yet!

I am doing service postfix restart after the postmap command but it does not work:

<family@starynk.net>: host
mail.starynk.net[private/dovecot-lmtp] said: 550 5.1.1
<family@starynk.net> User doesn't exist:
family@starynk.net (in reply to RCPT TO command)


 Reporting-MTA: dns; mail.starynk.net
 X-Postfix-Queue-ID: 4BDE761BFE
 X-Postfix-Sender: rfc822; basile@starynk.net
 Arrival-Date: Thu, 31 Dec 2015 10:08:07 +0100 (CET)

 Final-Recipient: rfc822; family@starynk.net
 Original-Recipient: rfc822;family@starynk.net
 Action: failed
 Status: 5.1.1
 Remote-MTA: dns; mail.starynk.net
 Diagnostic-Code: smtp; 550 5.1.1 <family@starynk.net> User doesn't
   exist: family@starynk.net

working (sortof)

I finally managed to have something working. My /etc/postfix/virtualaliases file has lines like:

# file /etc/postfix/virtualaliases by Basile without colons or commas
matt@starynk.net matt.star11@gmail.com
john@starynk.net john.starynk99@gmail.com
family@starynk.net matt@starynk.net john@starynk.net 
webmaster@melt.org basile@starynk.net

(of course I have to run postmap /etc/postfix/virtualaliases after every change)

but I still don't understand how could I have some alias to a Unix command pipe, and I am surprised by the lack of commas (which virtual(5) is suggesting)

  • Have you tried without virtual_alias_domains? In my setup i have only virtual_alias_maps configured and i have several domains. See docs for an explanation of those two. – Joe Dec 31 '15 at 10:13

If you use virtual_alias_maps = hash:/my/file as written in the postfix man page, you have to create the database with postmap /my/file everytime you change /my/file.

I don't know any function ir feature of postfix, which provides a "dry-run" action. You should test it in a VM locally, using a local dns and mailserver.

It won't affect any other configuration option.

  • But virtual_alias_maps won't interfere with other settings, including virtual_mailbox_domains ? – Basile Starynkevitch Dec 30 '15 at 21:18
  • No. Every configuraton option accepts its own database. It also possible to connect it to an ldap server or a mysql database. The default type is a postmap. – user149441 Dec 30 '15 at 21:20
  • Setting one option does not affect another one as long as there are no config errors. (Trying to redirect a alias whoes domain is not listed.) – user149441 Dec 30 '15 at 21:21
  • @EllDevender: it would be nice if you could edit your answer.... – Basile Starynkevitch Dec 31 '15 at 8:56
  • @EllDevender: I did the modification, and it does not work. How should I debug the issue? – Basile Starynkevitch Dec 31 '15 at 8:56

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.