[wplug] Sendmail

Brian Gollum brig at bidlum.net
Mon Jun 27 00:35:06 EDT 2005


On Fri, Jun 24, 2005 at 04:01:17PM -0400, Tom Rhodes wrote:
> Have you tried local-host-names?  Or is that only for accepting
> mail?

It is my understanding that local-host-names is used to disambiguate the
mail host when it has several entries that could be returned as a response
to a DNS query. I only use it for aliased names for my mail host within my
local domain.

To handle incoming mail for multiple domains I rely on definitions in the
virtual-domains (which lists my real and virtual domains) and virtusertable
(which defines how the envelope addresses on the incoming mail for these
domains will be rewritten) tables/files.

For example, my virtual-domains file contains lines similar to these:

	domain.net
	domain.com
	domain.org
	hosteddomain.org
	hosteddomain.com
	hosteddomain.net

And my virtusertable file contains lines similar to these:

	user1 at domain.com	user1+%1%3
	user2 at domain.com	user2+%1%3
	@domain.com		domain+%1%3
	@domain.org		domain+%1%3
	@hosteddomain.org	hosteddomain+%1%3
	@hosteddomain.com	hosteddomain+%1%3
	@hosteddomain.net	hosteddomain+%1%3

In my case, domain.net is my live domain, and everything else is virtual,
so the virtusertable defines which local users will receive the mail for
the virtual domains. So all mail addressed to @hosteddomain.{com,net,org}
will be delivered to the local user hosteddomain, for example. This is all
handled by the following sendmail.mc fragment:

	VIRTUSER_DOMAIN_FILE(`/etc/mail/virtual-domains')dnl
	FEATURE(`virtuser_entire_domain')dnl
	FEATURE(`virtusertable')dnl

To rewrite outgoing addresses I rely upon the generics feature. My
generics-domains file contains only an entry for my local live domain:

	domain.net

But the genericstable file contains entries that match against an address
in outgoing mail from a local user in my live domain, and rewrites it as
mail originating from a virtual domain:

	hosteddomain at domain.net		info at hosteddomain.org
	hosteddomain+*@domain.net	info+%1 at hosteddomain.org
	domain at domain.net		info at domain.com
	domain+*@domain.net		info+%1 at domain.com

Thus mail sent locally from the hosteddomain user account is rewritten as
originating from info at hosteddomain.org. This is handeled by the following
sendmail.mc fragment:

	GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
	FEATURE(`generics_entire_domain')dnl
	FEATURE(`genericstable')dnl

There are other ways of handling this. I would suggest getting a copy of
the Bat book, or checking out the sendmail.org site for information on
virtual hosting. Google is also your friend.

...b.



More information about the wplug mailing list