[exim] Mail Wrapper Question

Góra strony
Delete this message
Reply to this message
Autor: Kris Oye
Data:  
Dla: exim-users
Temat: [exim] Mail Wrapper Question
Greetings everyone! Quick question for a Exim guru!

My goal is to stop each message (system wide) as it comes in, analyze it, and then either send a virtually new message to the recipient and discard the original, or pass the original through untouched. The problem with my current approach is that every mail is getting processed twice (seems wasteful) [see below].

Is there a way I can write a Perl script and use it in a global, system_filter? Ultimately, the recipients will be virtual users and not system accounts, too. The local parts on my system are actually stored in a mysql database and the mail is stored in maildir_format. I feel like I should be able to do this in one step, but I don't know how :P

# my current routers:
# previously seen mail drops through
localuser:
condition = ${if match{$message_headers}{X-EkariaRewrite}{yes}{no}}
driver = accept
check_local_user
transport = local_delivery
cannot_route_message = Unknown user

# mail is finally delivered
local_user_wrap:
driver = accept
check_local_user
transport = local_wrap_delivery
cannot_route_message = Unknown user

# my current transports
# initial transport delivers to pipe that modifies message body, adds X-EkariaRewrite header
# and resends the mail back to the MTA.
local_wrap_delivery:
driver = pipe
command = "/localmail/processmail.pl ${sender_address} ${pipe_addresses}"
path = "/bin:/usr/bin:/usr/local/bin"
group = mail
user = exim
current_directory = "/localmail"