[exim] Filtering $return_path to $header_From: on bounce

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Charles (Chuck) Mattice
Fecha:  
A: exim-users
Asunto: [exim] Filtering $return_path to $header_From: on bounce
Hi,

I think I've come up with a system filter to deliver bounced messages.

Let me explain. I am just learning exim filters and this one had/has me
baffled.

at my company we have both local user emails and email addresses for
client domains. For the internet domains we use cPanel and RHE 3
dedicated servers with the default email address set to fail. Each
domain may have several email accounts and these typically work fine.
The problem I experience is when a client sends mail through a perl or
php script.

In apache suexec is enabled and phpsuexec is enabled so I don't have to
worry about the scripts running under the users account "nobody". What
happens though is the script sets the From: header correctly but the
mail server sets a different $reply_path that what is in the
$header_From: After searching I've come up with a filter I hope. It has
bombed on me in the past and my mail queue usually builds to the
thousands with no mail being sent and then I have to restart it. (Freeze
up city)

I could use a "Headed in the right direction or won't work comment" from
some experts.

Here's what I've come up with

logfile /var/log/filter.log

if $sender_address is “”
then
if
${lookup{${extract{2}{@}{$recipients}}}lsearch{/etc/localdomains}{yes}{no}}
is “no”
then
headers add “Old-Subject: $h_subject:”
headers remove “Subject”
headers add “Subject: [Delayed Bounce]$h_old-subject:”
headers remove “Old-Subject”
deliver “someaddress@somedomain”
fail text “Delayed bounce message ignored”
logwrite $message_id $h_subject
seen finish
elif
deliver $header_From:
seen finish
endif
endif

What I am looking for is to check for bounced messages, if I find one
then I want to check and see if it came from our server.
If not then I fail it and write the message_id to a logfile.
If it is then since all the default addresses are set to fail anything
that comes in has a $reply_path of user@mailserver. If fail was not
enabled then I wouldn't need this as it would go to the local user. With
fail though my local user's bounce message gets trashed so I want to
send it to the email address that the script uses which should be the
domain email address.

One question I have as well is in the system file the first filter is

If first_delivery
then
finish
endif

I believe the filter for bounces should come next and do I have the use
of "seen finish" set correctly if I want to process the message further
down the list.

Thanks for the input

Chuck Mattice