Exim Header Rewriting
Hello friends,
I have trouble with exims header rewriting feature. This is rather off
topic, if anybody can tell me where the exim list is located, I will happily
repost my question there. Thanks!
What I want to do is exactly what is in the Exim FAQ, Question 1003:
I want to rewrite local addresses in mail that goes to the outside world,
but not for messages that remain within the local intranet.
(this is not quite correct, because I would like to rewrite local mail, too,
but following different rules).
I have set up two exims, one listening to port 25, and one for outbond mail
listening to port 26. This is working fine. Mail for outside worl dis
forwarded by exim (25) to exim(26) nicely. But the header is just not
rewritten as it should. This message should be an example for that.
It says "paul@envi-net.de" in the From field although it should be rewritten
to "envi-gmbh.weihrauch@t-online.de".
I attach the two exim configuration files. exim.conf is for exim (25) and
exim-remote.conf is for exim (26). I am afraid this is some stupid mistake
on my side, but I just can't find out what it is.
I tested it with "exim -brw addresse" and "exim -C /etc/exim-remote.conf
-brw addresse" and the header was rewritten correctly.
I am also attaching my /etc/email-addresse and /etc/email-remote-addresses
files, which are referenced by the conf files.
Thank you,
Marcus
# ENVI DEFAULT CONFIGURATION #
ENVIDOMAIN = envi-net.de
ENVINET = 192.168.1.0/8
SMARTHOST = mailto.btx.dtag.de
# MAIN CONFIGURATION SETTINGS #
qualify_domain = ENVIDOMAIN
receiver_unqualified_nets = ENVINET
local_domains = localhost:ENVIDOMAIN:partial-ENVIDOMAIN
local_domains_include_host = true
local_domains_include_host_literals = true
never_users = root
host_lookup_nets = 0.0.0.0/0
sender_host_reject_relay = *
trusted_users = mail
smtp_verify = false
gecos_pattern = ^([^,:]*)
gecos_name = $1
received_header_text = "Received: \
${if def:sender_fullhost {from ${sender_fullhost} \
${if def:sender_ident {(${sender_ident})}}\n\t}\
{${if def:sender_ident {from ${sender_ident} }}}}\
by ${primary_hostname} \
${if def:received_protocol {with ${received_protocol}}} \
(Exim ${version_number} #${compile_number} (Debian))\n\t\
id ${message_id}"
end
# TRANSPORTS CONFIGURATION #
local_delivery:
driver = appendfile
group = mail
mode = 0660
mode_fail_narrower = false
file = /var/spool/mail/${local_part}
address_pipe:
driver = pipe
return_output
address_file:
driver = appendfile
address_directory:
driver = appendfile
no_from_hack
prefix = ""
suffix = ""
address_reply:
driver = autoreply
##############
# This is used to forward mail to exim (26)
##############
local_smtp:
driver = smtp
service = 26
# DIRECTORS CONFIGURATION #
real_local:
prefix = real-
driver = localuser
transport = local_delivery
system_aliases:
driver = aliasfile
file = /etc/aliases
search_type = lsearch
userforward:
driver = forwardfile
no_verify
check_ancestor
file = .forward
modemask = 002
filter
localuser:
driver = localuser
transport = local_delivery
end
# ROUTERS CONFIGURATION #
pass_remotes:
driver = domainlist
transport = local_smtp
route_list = * localhost byname
self = send
end
# RETRY CONFIGURATION #
* * F,2h,15m; G,16h,2h,1.5; F,4d,8h
end
# REWRITE CONFIGURATION #
*@t-online.de ${lookup{${lc:$1}lsearch{/etc/email-addresses}\
{$value}fail} bcfrF
# ENVI DEFAULT CONFIGURATION #
ENVIDOMAIN = envi-net.de
ENVINET = 192.168.1.0/8
SMARTHOST = mailto.btx.dtag.de
local_domains =
local_interfaces = 127.0.0.1
sender_host_accept = 127.0.0.1
spool_directory = /var/spool/exim-remote
end
# TRANSPORTS CONFIGURATION #
remote_smtp:
driver = smtp
headers_add = Organization: ENVI * Energy & Environment * Dortmund
end
# DIRECTORS CONFIGURATION #
# We do not need directors for local mail for the exim that handles
# remote mail only.
end
# ROUTERS CONFIGURATION #
smarthost:
driver = domainlist
transport = remote_smtp
route_list = * SMARTHOST bydns_a
end
# RETRY CONFIGURATION #
* * F,2h,15m; G,16h,2h,1.5; F,4d,8h
end
# REWRITE CONFIGURATION #
*@*.envi-net.de $1@envi-net.de Fbcfrs
*@envi-net.de ${lookup{$1}lsearch{/etc/email-remote-addresses}\
{$value}fail} bcfrFs
envi-gmbh.weihrauch: paul@envi-net.de
paul: envi-gmbh.weihrauch@t-online.de
Reply to: