5 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] Re: Replace functiona...
FromSent OnAttachments
Robin BowesJul 20, 2004 9:41 am 
Sam VarshavchikJul 20, 2004 5:38 pm 
Robin BowesJul 21, 2004 12:28 am 
Sam VarshavchikJul 21, 2004 4:09 am 
Robin BowesJul 21, 2004 4:38 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] Re: Replace functionality in maildrop?Actions...
From:Robin Bowes (robi@robinbowes.com)
Date:Jul 21, 2004 12:28:38 am
List:net.sourceforge.lists.courier-maildrop

On Wed, July 21, 2004 1:23, Sam Varshavchik said:

Robin Bowes writes:

Is there any string "replace" functionality in maildrop? I've checked the docs
and there doesn't seem to be but I thought I'd ask here to check.

Nope. You are on the right track attempting to use an external program.

Sam,

I have posted this stuff in another thread but I've had a few mail problems of
late so I'm not sure if it made it to the list so I'll copy and paste it here:

I'm using maildrop as delivery agent in a qmail system.

I'm using the pattern matching to identify messages from mailing lists and
auto-file them in the appropriate folders.

I'm using bincimap with IMAPDir depots so I can have folder names with the "." character in them but they need to be escaped, e.g. "courier-maildrop@lists\.sourceforge\.net".

Here are some relevant lines from mailfilter.

First I look for a mailing list:

if ( /^List-Post: <mailto:![0-9A-Za-z_\-]*!@.*!>/ \ || /^Delivered-To: mailing list ![0-9A-Za-z_\-]*!@.*/ \ || /^X-Mailing-List:[:space:]![0-9A-Za-z_\-]*!@.*/ ) {

Then construct the list name from the matched vars and deliver to the maildir:

exception { LIST_FOLDER_NAME=${MATCH2}${MATCH3} to "${VMAILDIR}/${LISTS}.${LIST_FOLDER}/" }

(I've removed the code that creates the maildir if it doesn't already exist)

Now, what I need to do is to replace the "." characters in LIST_FOLDER_NAME with
"\."

First I tried using sed as follows:

LIST_FOLDER_NAME=`echo ${MATCH2}${MATCH3} | sed 's/\./\\\./g'`

This works from the command prompt:

# echo x.y.z | sed 's/\./\\\./g' x\.y\.z

...but doesn't do the business in maildrop.

Then I stumbled across the "escape" function. Brilliant! Just what I want! So I tried this:

LIST_FOLDER_NAME=escape(${MATCH2}${MATCH3})

This didn't work either; the list address remained unchanged.

Any idea how I can get this to work?

Thanks,

R.