0

Hi sorry for a bit of a newbie exim question.

For historic reasons we have email going through a smart host addressed to something like: johnsmith+12345+@destinaton.com (where 12345 can be any number)

We need to understand how to get Exim to rewrite and remove the +923423+ before it attempts to send to the remaining corrected address.

Our somewhat feeble attempts have failed :(

Be really grateful for any pointers as in how to do it and where in the conf file we should be doing it?

Thanks in advance

KeithO
  • 3
  • 1
  • It would have been helpful to show what you already have tried. – wurtel Mar 25 '19 at 08:49
  • Agreed, apologies. My attempts were so far off base I didn't feel they'd have added anything useful but I do see your point. – KeithO Mar 26 '19 at 09:04

1 Answers1

0

In the exim.conf file, there should be this line:

begin rewrite

Below that line you can place rewriting rules. You probably need a rule like this:

\N^(.*)\+[0-9]+\+@(.*)$\N $1@$2 tT

The \N pair indicate to exim that the enclosed string shouldn't be subjected to $ and \ handling. Then the first part is captured up to the numeric part with a plus before and after it, then the part after the @ is captured. The replacement is simply the first and second captured string with @ between. The tT flags mean to replace the To address in the header (t) and in the envelope (T).

It may be necessary to add a S flag to tT as this is on a smarthost and rewriting probably needs to be done at SMTP time.

wurtel
  • 3,806
  • 12
  • 15