-
Notifications
You must be signed in to change notification settings - Fork 178
Q0405
On a host that accepts mail for several domains, do I have to use fully qualified addresses in /etc/aliases or do I have to set up an alias file for each domain?
You can do it either way. The default aliasing router contains this line:
data = ${lookup{$local_part}lsearch{/etc/aliases}}
which is what does the actual lookup. To make it look up the complete address instead of just the local part, use
data = ${lookup{$local_part@$domain}lsearch{/etc/aliases}}
If you want to use a separate file for each domain, use
data = ${lookup{$local_part}lsearch{/etc/aliases/$domain}}
domain_aliases:
debug_print = "domain_aliases for $local_part@$domain"
driver = redirect
allow_defer = yes
allow_fail = yes
data = ${lookup{$local_part}lsearch*{${lookup{$domain}partial-lsearch{DOMAINDIR/map}\
{DOMAINDIR/$value}} }}
domains = partial-lsearch;DOMAINDIR/map
retry_use_local_part = yes
This router has a directory DOMAINDIR (you can use that as a macro or replace the three occurrences of the macro in the router). DOMAINDIR/map maps a domain to a file name (domain: filename), while DOMAINDIR/filename is the actual alias file. That way, you can map multiple domains to the same alias file.
DOMAINDIR/map
example.com: example1
example.org: example2
example.net: example2
example.biz: example3
DOMAINDIR/example1
user1: bill
DOMAINDIR/example2
user2: alison
DOMAINDIR/example3
*: bill
that way, `[email protected]`_ gets delivered to bill, while `[email protected]`_ and `[email protected]`_ both get delivered to alison, with all other combinations being handed down to the next router.
In the last example any messages sent to example.biz (like `[email protected]`_) will be delivered to bill. Note: This catches ALL messages sent to example.biz. It might and probably will also increase the amount of incoming spam
**-------------------------
-------------------------**
FAQ_ / `Routing for local delivery`_ **/ Q0405
-------------------------**
CategoryFrequentlyAskedQuestions_
- I need to have any mail for virt.dom.ain that doesn't match one of the
- How do I arrange for all incoming email for *@some.domain to go into
- How do I configure Exim to send messages for unknown local users to a
- How can I arrange for messages submitted by (for example) Majordomo to
- On a host that accepts mail for several domains, do I have to use fully
- Some of my users are using the .forward to pipe to a shell command
- How can I arrange for a default value when using a query-style lookup
- If I don't fully qualify the addresses in a virtual domain's alias file
- I want mail for any local part at certain virtual domains to go to a
- How can I make Exim look in the alias NIS map instead of /etc/aliases?
- Why will Exim deliver a message locally to any username that is longer
- Why am I seeing the error bad mode (100664) for /home/test/.forward?
- When a user's .forward file is syntactially invalid, Exim defers
- I have set
caseful_local_part
on the routers that handle my local - Can I use my existing alias files and forward files as well as procmail
- What is quickest way to set up Exim so any message sent to a
- What do I need to do to make Exim handle /usr/ucb/vacation processing
- I want to use a default entry in my alias file to handle unknown local
- I have some obsolete domains which people have been warned not to use
- How can I arrange that mail addressed to
- I can't get a regular expression to work in a
local_parts
option on - How can I arrange for all addresses in a group of domains
- Some of our users have no home directories; the field in the password
- How can I disable Exim's de-duplication features? I want it to do two
- My users' mailboxes are distributed between several servers according to
- One of the things I want to set up is for anything@onedomain to
- How can I have an address looked up in two different alias files, and
- I've converted from Sendmail, and I notice that Exim doesn't make use of
- I would like to deliver mail addressed to a given domain to local
- Whenever Exim tries to route a local address, it gives a permission
- How do I configure Exim to allow arbitrary extensions in local parts, of
- I use NIS for my user data. How can I stop Exim rejecting mail when my
- How can I arrange for a single address to be processed by both
- How can I redirect all local parts that are not in my system aliases to
- My alias file contains fully qualified addresses as keys (as it was used