1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52
from spec on 25 November 2000 -->
<TITLE>Exim Specification - 43. Virtual domains</TITLE>
</HEAD>
<body bgcolor="#FFFFFF" text="#00005A" link="#FF6600" alink="#FF9933" vlink="#990000">
Go to the <A HREF="spec_1.html">first</A>, <A HREF="spec_42.html">previous</A>, <A HREF="spec_44.html">next</A>, <A HREF="spec_59.html">last</A> section, <A HREF="spec_toc.html">table of contents</A>.
<P><HR><P>
<H1><A NAME="SEC794" HREF="spec_toc.html#TOC794">43. Virtual domains</A></H1>
<P>
<A NAME="IDX1727"></A>
<A NAME="IDX1728"></A>
There are a number of ways in which virtual domains can be handled in Exim.
As this seems to be quite a common requirement, some ways of doing this are
described here. These are not the only possibilities.
</P>
<P>
<H2><A NAME="SEC795" HREF="spec_toc.html#TOC795">43.1 All mail to a given host</A></H2>
<P>
Simply sending all mail for a domain to a given host isn't really a virtual
domain; it is just a routing operation that can be handled by a <EM>domainlist</EM>
router.
</P>
<P>
To send all mail for a domain to a particular local part at a given host,
define the domain as local, then process it with a <EM>smartuser</EM> director that
sets the new delivery address and passes the message to an <EM>smtp</EM> transport
which specifies the host.
Alternatively, use a <EM>forwardfile</EM> director pointing to a fixed file name; the
file can contain any number of addresses to which each message is forwarded.
</P>
<H2><A NAME="SEC796" HREF="spec_toc.html#TOC796">43.2 Virtual domains not preserving envelopes</A></H2>
<P>
A virtual domain that does not preserve the envelope information when
delivering can be handled by an alias file defined for a local domain.
If you are handling a large number of local domains, you can define them as a
file lookup. For example:
<PRE>
local_domains = your.normal.domain:\
dbm;/customer/domains
</PRE>
<P>
Where <EM>/customer/domains</EM> is a DBM file built from a source file that
contains just a list of domains:
<PRE>
# list of virtual domains for customers
customer1.domain
customer2.domain
</PRE>
<P>
This can be turned into a DBM file by <EM>exim_dbmbuild</EM>.
</P>
<P>
You can then set up a director (see below) to handle the customer domains,
arranging a separate alias file for each domain. A single director can handle
all of them if the names follow a fixed pattern. Permissions can be arranged so
that appropriate people can edit the alias files. The <EM>domains</EM> option ensures
that this director is used only for the customer domains. The DBM file lookup
is cached, so it isn't too inefficient to do this. The <EM>no_more</EM> setting
ensures that if the lookup fails, Exim gives up on the address without trying
any subsequent directors.
<PRE>
virtual:
driver = aliasfile
domains = dbm;/customer/domains
no_more
file = /etc/mail/$domain
search_type = lsearch
</PRE>
<P>
A successful aliasing operation results in a new envelope recipient address,
which is then directed or routed from scratch.
</P>
<H2><A NAME="SEC797" HREF="spec_toc.html#TOC797">43.3 Virtual domains preserving envelopes</A></H2>
<P>
If you want to arrange for mail for known local parts at certain domains to
be sent to specific hosts without changing the envelope recipients of messages,
then the following is one way of doing it.
</P>
<P>
Set up the domains as local, and create an <EM>aliasfile</EM> director for them, as
above, but in addition, specify a transport for the director:
<PRE>
virtual:
driver = aliasfile
domains = dbm;/customer/domains
transport = virtual_smtp
no_more
file = /etc/mail/$domain
search_type = lsearch
</PRE>
<P>
Each domain has its own alias file, but the provision of a transport means that
this is used purely as a check list of local parts. The data portion of each
alias is not used.
</P>
<P>
The transport has to look up the appropriate host to which the
message must be sent:
<PRE>
virtual_smtp:
driver = smtp
hosts = ${lookup{$domain}dbm{/virtual/routes}{$value}fail}
</PRE>
<P>
The file <EM>/virtual/routes</EM> contains lines of the form
<PRE>
customer1.domain: cust1.host
customer2.domain: cust2.host
</PRE>
<P>
and the messages get delivered with RCPT (the envelope) containing the
original destination address (for example, <EM>postmaster@customer1.domain</EM>). In
fact, you could use the same file for <EM>/virtual/routes</EM> and
<EM>/customer/domains</EM>, since the lookup on the latter doesn't make any use of the
data -- it's just checking that the file contains the key.
</P>
<P><HR><P>
Go to the <A HREF="spec_1.html">first</A>, <A HREF="spec_42.html">previous</A>, <A HREF="spec_44.html">next</A>, <A HREF="spec_59.html">last</A> section, <A HREF="spec_toc.html">table of contents</A>.
</BODY>
</HTML>
|