On Thu, Dec 13, 2012 at 10:55:35AM +0100, LEVAI Daniel wrote: > I thought I could combine (chain together) my alias_{database,maps} > tables with my virtual_alias_maps table. > I figured that if I specify in my aliases table: > root: daniell > and in my virtual table: > daniell daniell@email_address > then mails for root from localhost would end up in the specified > daniell@email_address mailbox (on another machine, using relayhost).
The local(8) delivery agent does not recurse into virtual(5) alias expansion when expanding local aliases(5). If an address on the right side of an alias resolves to a domain in $mydestination (after append_at_myorigin or append_to_mydomain as required) it is delivered in by the same delivery agent after additional aliases(5) expansion, and is not reprocessed as a new message via cleanup(8). This is for compatibility with legacy Sendmail behaviour with respect to loop-detection, ... My approach is to handle all mail forwarding in virtual_alias_maps, and to ensure that the domain behind "$myorigin" is NOT listed in "$mydestination". Rather "mydestination = localhost.$mydomain" or perhaps even "mydestination = localhost.invalid", and mail only ends up in the local mailer's clutches when explicitly forced there via a rewrite: mailbox@domain local-mailbox@localhost.invalid When local-mailbox is expanded via aliases(5), the only addresses on the right side of aliases that end up in mailboxes rather than forwarded back into the queue for reprocessing are those that explicitly resolve to the local domain: local-mailbox: foo, bar@localhost.invalid The "foo@$myorigin" recipient will be forwarded back into the queue for processing via cleanup(8), (thus virtual(5), ...), while bar@localhost.invalid will be delivered directly. The local(8) delivery agent is legacy Sendmail compatibility, use it sparingly. Its most useful feature is ":include:" support for integration with mailing-list managers. Very few people still read email out of mbox files in /var/spool/mail, an MTA typically delivers email into a mail-store (Dovecot, Cyrus, ...) and the legacy support in local(8) should be used exclusively for any pipe targets that can't easily be supported by other means and for ":include:" lists. Don't use aliases(5) for mail forwarding to rfc822 addresses, that's what virtual(5) is for. -- Viktor.