Hi,
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.