Q0808

Nigel Metheringham edited this page Nov 29, 2012 · 2 revisions
Clone this wiki locally

Question

I want to rewrite recipient address depending on the domain of the sender... qend

For example:

*@example.com        *                        FtTq
\N^.+@mr-spark\N     kamenskiyvv@example.com  FtT
\N^.+@rewind\N       rodenkovig@example.com   FtT
\N^.+@eug\N          lyzoev@example.com       FtT
\N^.+@tux\N          volzhankinsv@example.com FtT
\N^.+@proj-ws-43\N   syazantsevae@example.com FtT
\N^.+@proj-lx-29\N   nekhaichikaa@example.com FtT
*@example.com        *                        FtTq
*                    developer@localhost      FtT

So I want the following:

  1. If mail is sent for *@example.com then it will be sent to *@example.com

  2. If mail is sent from *@rewind then it will be sent to rodenkovig@example.com

  3. If mail is sent from *@eug then it will be sent to lyzoev@example.com

  4. ...

  5. Otherwise mail will be send to local mailbox developer@localhost

But the rules don't work property, for example:

If I use exim -brw kamenskiyvv@proj-lx-29 it all works well:

sender: kamenskiyvv@proj-lx-29
from: kamenskiyvv@proj-lx-29
to: nekhaichikaa@example.com
cc: kamenskiyvv@proj-lx-29
bcc: kamenskiyvv@proj-lx-29
reply-to: kamenskiyvv@proj-lx-29
env-from: nekhaichikaa@example.com
env-to: nekhaichikaa@example.com

But if I send mail from proj-lx-29 host I will see the following in the log:

2007-10-31 13:51:39 1InDyt-0007Zy-0O <= nekhaichikaa@example.com H=proj-lx-29 [192.168.9.29] P=smtp S=418
2007-10-31 13:51:39 1InDyt-0007Zy-0O => developer <developer@localhost> R=localuser T=local_delivery
2007-10-31 13:51:39 1InDyt-0007Zy-0O Completed

Answer

Your rules are incorrect, exim rewrites only addresses that are matched with expression. If rule can be applied to only From header it will be applied to From Header only.