Hi Sidney,

> [2026-01-07 13:15] Sidney Cadot <[email protected]>
> > I am trying to get a configuration working where I do the following:
> >
> > - accept incoming mail via SMTP for a domain "wherewithal.nl" (i.e.,
> > [email protected] );
> > - rewrite the destination address of that mail to a single gmail address;
> > - relay the altered mail to my ISPs smarthost.
> > - reject other inbound mail.
> >
> > I have been experimenting a bit, but I can't get it to work. Specifically,
> > address rewriting via "alias" is an option specific for local delivery,
> > where I want address rewriting for mail that will be relayed.

I did this with two virtual tables:

--------------------------------------------------
action "expand_forwards" expand-only virtual <forwards>
action "local_mail" lmtp "/var/run/dovecot/lmtp" rcpt-to virtual <virtuals>
action "outbound" relay srs helo mail.janeden.org

match from any for rcpt-to <forwards> action "expand_forwards"
match from any for rcpt-to <virtuals> action "local_mail"
match from any auth for any action "outbound"
match from local for any action "outbound"
--------------------------------------------------

Everything gets resolved (expanded) via the <forwards> table first, and
the result is either handled according to the <virtuals> table (two
virtual mailboxes), or relayed. If there are no virtual mailboxes, and
you do not send mails as an authenticated user, the setup can be
simplified to:

--------------------------------------------------
action "expand_forwards" expand-only virtual <forwards>
action "outbound" relay srs helo mail.janeden.org

match from any for rcpt-to <forwards> action "expand_forwards"
match from local for any action "outbound"
--------------------------------------------------

Note that this only covers destinations defined in <forwards>
explicitly, other destinations for your domain will be rejected.

- Jan

Reply via email to