[exim] Rudimentary mailing list - address rewriting

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Ray O'Donnell
Datum:  
To: exim-users
Betreff: [exim] Rudimentary mailing list - address rewriting
Hi all,

Short version: in a simple mailing-list setup, how should I rewrite the
sender address so that emails to the list are then re-sent from the list
address?

Longer version:

I'm running a simple virtual-mailbox setup with Exim, where domain and
user details are stored in a PostgreSQL database. This is on an AWS host
(Lightsail), and uses Amazon SES as a smarthost for outgoing email. All
is working fine so far.

I now need to add what are effectively simple mailing lists - email
addresses which will forward to multiple recipient addresses, mostly
outside the domains handled by our setup. I've added a router (appennded
below) based on an example in the Exim book, which checks whether an
incoming email is for a list address, and - if it is - redirects to the
list members. So far so good.

Now, I need to rewrite the "From" header to the list address, so that
SES will send out the emails to the list recipients. How should I do
this? It doesn't seem to be possible to use headers_rewrite in a router
(I tried and got an error). One thing I thought of was to create a
separate transport which checks for the presence of a List-ID header
(which is added in the router, and contains just the list address), and
changes the "From" address to its value using headers_rewrite - would
this be a viable approach?

On the same topic, is there anything else I should be doing? This isn't
a full-blown mailing list solution - we just need a small number (5-10)
of group addresses, each going to a small number (<20) of recipients -
but I want to do it right.

Here's my router as it stands (yes, I know there are more DB lookups
than I need - it's a work in progress):

vmail_maillist:
 debug_print = "R: vmail_maillist for $local_part@$domain"
 driver = redirect
 condition = ${lookup pgsql{ select 'true' from mailing_lists where
is_enabled = true \
     and list_name = '${quote_pgsql:$local_part}' and domain_name =
'${quote_pgsql:$domain}'}}
 data = ${lookup pgsql{ select recipient from mailing_list_recipients
where \
     list_name = '${quote_pgsql:$local_part}' and domain_name =
'${quote_pgsql:$domain}' }}

 # Get the list address as a variable, to save on lookups.
 set = r_list_address = ${lookup pgsql{  select list_name || '@' ||
domain_name from mailing_lists \
     where list_name = '${quote_pgsql:$local_part}' and domain_name =
'${quote_pgsql:$domain}' }}

 # Remove any DKIM header, as the outgoing emails get signed by SES.
 headers_remove = DKIM-signature

 # Add the list ID.
 headers_add = "List-ID: $r_list_address"

 forbid_pipe
 forbid_file
 no_more


Very many thanks in advance,

Ray O'Donnell.

--
Raymond O'Donnell // Galway // Ireland
ray@???

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/