1

First, I would like to thank you for your time.

I've come to the following situation:

  • I've got a mail server named mx1.domain.com

  • This mail server is virtual hosting some domains mail accounts like [email protected], [email protected]

  • As long as the hostname for the server is (and should be so the SMTP Banner is the same hostname as the IP rdl to) mx1.domain.com the default Postfix accounts and server accounts [email protected] [email protected] ... are binded to the real hostname, not virtuals.

  • I've got a simple user for login through ssh, and I've set up my /etc/aliases so the email for all those 'default' addresses go to root user and then I set up root mail to get into my login user instead.

How can I get all those emails, that my system and users send to those default addresses on a real email account? Like one of those that I virtual host.

0

2 Answers 2

3

I assume, that POSTFIX is your local MTA. Thus the following should solve your problem:

echo "[email protected]" > $HOME/.forward

(http://www.postfix.org/local.8.html)

5
  • This supposes that the addresses correspond to actual local accounts - which does not seem to be the case, since the poster mentiones virtually hosted domains.
    – Jenny D
    Commented Feb 18, 2014 at 11:29
  • no... you can use any email address in the .forward file. just like [email protected] - i used this many times in the past.
    – Wolfie
    Commented Feb 18, 2014 at 18:10
  • You misunderstand me. The address where the .forward file lives must be a local account on the server.
    – Jenny D
    Commented Feb 19, 2014 at 6:42
  • maybe i did... but i read the OPs question in the way that he wants exactly that: to have the local account's email forwarded to a virtual mailbox :)
    – Wolfie
    Commented Feb 21, 2014 at 23:18
  • Yep Wolfie is right, Maybe next time I'll make shorter questions. Commented Feb 22, 2014 at 15:28
1

Postfix has a feature to connect a virtual domain to a particular user. It's described in the virtual readme. Here's a short step-by-step guide:

Add the following lines to /etc/postfix/main.cf

virtual_alias_domains = example.com second.example.com
virtual_alias_maps = hash:/etc/postfix/virtual

Edit /etc/postfix/virtual and add a mapping for each domain to a username

# one address in example.com goes to a specific address
[email protected]   postmaster
# all other addresses in example.com go to oneuser
@example.com             oneuser
# all addresses in second.example.com go to seconduser
@second.example.com      seconduser

Once you've finished this, do the following:

postmap /etc/postfix/virtual
postfix reload

Whenever you add a domain or change a forwarding, just /etc/postfix/virtual and do postmap /etc/postfix/virtual again.

1
  • I'm sorry that maybe I didn't explained well, so You've interpreted my question backwards, Wolfie's hint is doing great what I wanted. Commented Feb 22, 2014 at 15:25

You must log in to answer this question.

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