The following is one of the criteria in my .mailfilter:
# File Courier-Maildrop mailing list messages:
if (/^List-ID:.*courier-maildrop/)
{
xfilter "${REFORMAIL} -A 'X-WVFans-Mailfilter: 0x0301'"
MATCH=escape(${MATCH})
xfilter "${REFORMAIL} -A 'X-WVFans-Match: ${MATCH}'"
to "$DEFAULT/.Doc.WVFans_net.Courier-Maildrop.Inbox"
}
I add a header to mail delivered with Maildrop indicating which rule was
used to move the file, in this case #0x0301, as well as the regular
expression that satisfied the criteria. I'm running into an error with
the mail received from the Maildrop mailing list because the $MATCH
expression contains a single apostrophe (') in the regular expression. I
get the following error in my mail.log:
unexpected EOF while looking for matching `''
It appears that $MATCH is replaced with the actual expression as the
.mailfilter is parsed and the single quote is not matched, giving the
above error.
How do I work around this? I've tried various combinations of quotes,
braces, and brackets, but with no success. I realize that I can change
my regexp criteria, knowing that the single quote will cause my header
addition to fail, but I would like to learn more how I can safely add
text headers to an email message. I believe this is one of the purposes
of the escape() function.
Rx