4 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] xfilter question
FromSent OnAttachments
Chris PetersenMar 4, 2005 10:18 am 
Devin RubiaMar 4, 2005 10:41 am 
Chris PetersenMar 7, 2005 10:31 am 
Devin RubiaMar 8, 2005 10:58 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] xfilter questionActions...
From:Devin Rubia (dev@thezone.net)
Date:Mar 4, 2005 10:41:06 am
List:net.sourceforge.lists.courier-maildrop

On Fri, Mar 04, 2005 at 10:17:29AM -0800, Chris Petersen wrote:

I'm currently trying to set up an xfilter, but not sure how to get maildrop to do what I want with it.

Basically, I'm receiving an email from a customer containing some info to schedule an order. I then send it to an xfilter, which parses the message content to verify validity, post the data to a URL (mail server doesn't have direct access to the DB), and then return success or error.

A successful entry should set EXITCODE=99, other error codes are also passed back via $RETURNCODE. My problem is that I'd like to be able to print messages back to the user.. So if there is a permanent failure (like the message coming from an unlisted IP address, or a data-format error) I can tell the sender exactly what went wrong, but maildrop seems to freak out of my xfilter returns nonzero (and/or prints to STDERR, I'm not sure which, since the STDERR does show up in the maillog)

Other errors (like the web/db server being down) would return a temorary failure and requeue the message.

Is there a way to do something like this? I was trying to keep as much as possible in my script (just to keep the mailfilter file somewhat clean), though I guess I can just change my return codes to something custom, and handle them in the mailfilter file (as long as it won't freak out for a nonzero returncode). I don't actually need xfilter (I don't want to modify the message), but it was the only way I could clearly see that would get the message content (headers and body) into my script.

You don't want xfilter, you want cc.

Since you want to trap errors, use an exception:

exception { cc "| /local/bin/somescript" }

cc will set $EXITCODE for you when sending to a program so you can still parse on it.