[exim] re-add local_part_suffix after a rewrite

Top Page
Delete this message
Reply to this message
Author: Guy Antony Halse
Date:  
To: exim-users
Subject: [exim] re-add local_part_suffix after a rewrite
Hi

I'm trying to find a way to re-add a local_part_suffix to an email address
after alias rewrites have happened. I've tried a number of things to achieve
this, but can't get it quite right. If anyone has ideas of how to do this,
I'd appreciate some help.


The background is as follows:

We have email addresses that are different to usernames (and thus mailbox
names) for historical reasons. At the moment we handle this by rewriting
the email address into a mailbox name using a router, removing a
local_part_suffix in the process:

staff_ru_aliases:
driver = redirect
domains = ru.ac.za
local_part_suffix = +*
local_part_suffix_optional
data = ${lookup{$local_part}dbm{/usr/local/etc/exim/staff-imap.db}}

Which would, for example, convert G.Halse@??? (or
G.Halse+anything@???) -> spgah@??? for delivery.

Using local_part_suffix_optional in this router allows people to use
plus-addressing on their email addresses, which many of our users find
convenient.

This mail is subsequently routed into a remote cyrus via lmtp like this:

cyrus_router:
driver = accept
domains = imap.ru.ac.za
address_data = $local_part
transport = cyrus_transport

The same cyrus_router is used for other deliveries too. However, the
original local_part_suffixes have been lost.

We'd like to extend the plus-addressing to take advantage of cyrus' ability
to deliver into subfolders. Cyrus supports plus-addressing for this, which
works (we've tested it). Thus I somehow need to re-insert the original
local_part_suffix after the alias rewrite is complete (i.e.
G.Halse+anything@??? -> spgah+anything@???).

Thanks,

- Guy
-- 
Manager: Systems, IT Division, Rhodes University, Grahamstown, South Africa
Email: G.Halse@???   Web: http://mombe.org/   IRC: rm-rf@???
*** ANSI Standard Disclaimer ***                                    J.A.P.H