Dnia 21.01.2024 o godz. 23:35:39 Simon Hoffmann via Postfix-users pisze:
> I have also read http://www.postfix.org/VIRTUAL_README.html and this
> states that with virtual alias mode i can have the same local part in an
> email address and deliver them to different unix users, but i can still
> use local unix users.

If you have for example domains example1.com, example2.com and example3.com,
one of them (say example1.com) can be your "main" domain where you use unix
users as mail destinations, ie. use...@example1.com. You DON'T put any
addresses in that domain in virtual_alias_maps, you just list that domain in
mydestination= parameter in main.cf.

The other two domains, example2.com and example3.com, will be virtual
domains. You DON'T list them in mydestination=, but you can handle addresses
in virtual domains in two different ways.

First, you can put the addresses in virtual_alias_table, and redirect the
mail addressed to virtual users either to real unix users on your system OR
to remote users on another server.

Of course the following should work (if not, then you have done something
wrong):

usern...@example2.com    someuser
usern...@example3.com    otheruser

and redirect mail sent to "usern...@example2.com" to user "someuser" on your
system, and mail sent to "usern...@example3.com" (the same localpart) to
another user "otheruser".

The second option is to have virtual mailboxes, where mail is just delivered
to some place in the filesystem and you have arranged some method for your
virtual users to pick it up (eg. via Dovecot).

You list the domain in virtual_mailbox_domains=, and use
virtual_mailbox_maps (and possibly other related parameters like eg. 
virtual_mailbox_base) to specify location of the individual mailboxes like:

u...@example4.com   /vbox/example4/user

I'm using such a setup, with all three kinds of domains (a "real" one,
virtual alias and virtual mailbox) and everything works as intended.

> The first method on that page does not allow me to route
> localp...@domain1.com to a different user than localp...@domain2.org (with
> the exact same localpart)

By "first method" do you refer to the section "As simple as can be: shared
domains, UNIX system accounts". Yes, in that case you just have two fully
equivalent domains, both listed in mydestination=. Each unix user, by
definition, "belongs" to ALL domains listed in mydestination=.

> and the third mode on that page does not use
> unix users and their home directory to store mails but just a directory
> structure, which is also not what i want.

This is the virtual mailbox example mentioned above.

So you need the second one: "Postfix virtual ALIAS example: separate
domains, UNIX system accounts", as Viktor already explained to you.

> The file that maps an email address to a unix user or another email
> address in OpenSMTPd is literally stated in the config with the keyword
> "virtual".

The Postfix equivalent is virtual_alias_maps.

> With the information from http://www.postfix.org/VIRTUAL_README.html I
> understand that this line means that this email address is delivered to
> the unix user on the RHS. Why would I need to specify a domain on the RHS
> if i want the unix user simon to get the mail?

You don't have to.

You have to remember that because virtual aliasing is done in the cleanup(8)
process, and mail whose RHS is "simon" is then passed to local(8) process
for delivery, it may be subject to further aliasing in that process,
according to alias_maps table (whose default value is /etc/aliases). So if
you have defined in your virtual_alias_table:

usern...@domain2.com   simon

and in your /etc/aliases file:

simon   extu...@example.net

then the mail will be effectively forwarded to extu...@example.net, and not
delivered to local user simon (but the same applies to all mail addressed to
local user simon, regardless of the origin).
-- 
Regards,
   Jaroslaw Rafa
   r...@rafa.eu.org
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to