On 03 December 2001, Ed Murray said:
> I create a user service and created a filter file to check the
> header and deliver the email to the users depending on the header.
> The file looks like this:
>
> # Exim filter
>
> if $header_to contains "service@???"
> then
> deliver usera
> else
> deliver userb
> endif
I'm pretty sure this is not the right way to handle virtual domains with
Exim. I don't know what the right way *is*, but the most obvious thing
wrong with this is that there is no guarantee that the actual recipient
is mentioned in the "To" header. In the most elementary case, what if
the message is
To: joe@???
Cc: joe@???
? How will your filter handle that?
At a bare minimum, you should use probably use $domain, not $header_to,
to determine what to do.
> I have checked this is exim -bF and exim -bf and it works. The
> problem is when I put it in as the .forward file it does not work. It
> does not process the "if" line properly. Everything fails and the
> "else" clause it always used.
Another relevant question: *which* .forward file? By the time Exim gets
to a .forward file, it has already decided which user is receiving the
message (joe@sales or joe@engineering). So there's no point in trying
to discriminate in .forward!
(Unless of course your .forward files are not really per-user, but
per-localpart, in which case you don't have to call them .forward, and
they don't have to live in a home directory mentioned in /etc/passwd.
Search the Exim spec for "central_filter" -- there's a great example
buried somewhere deep in the fine manual.)
Greg
--
Greg Ward - software developer gward@???
MEMS Exchange http://www.mems-exchange.org