Hi Guys,
My first attempt at handcrafting a maildrop filter.... and its not that it
doesn't work, its that I'm getting stuck trying to fix it!
The purpose of the filter is to manipulate the delivered to header for
messages delivered using @domain aliases to a mailbox using .courier-default
to implement a catchall... the delivered to header shows the local mailbox
name, and I want to rewrite it to give the username that the message was
addressed to, which isn't always apparent eg in a bcc scenario. The script
is below. I'm curious if its a type issue, and if I can typecast to get
around, eg, that its trying to subtract a string from an int etc.
Any help appreciated!
-Enda.
# First I declare some once off hard coded variables.
DTLD="domain.com"
USTART="32"
EXCESS="55"
# Extract the current Delivered-to: header from the mail
DELTO=/Delivered-To:/:h
# **** this is where I'm getting the syntax error *******
# Calculate the length of the uid plus the already appended @ character
# My first attempt - ULENGTH=((length(DELTO))-$EXCESS) - bracket error
# My next attempt - ULENGTH=(length(DELTO))-$EXCESS - syntax error
# My next attempt - ULENGTH=(length($DELTO))-$EXCESS - syntax error
# My next attempt - ULENGTH=length(DELTO)-$EXCESS - syntax error
# My final attempt: - syntax error
ULENGTH=length($DELTO)-$EXCESS
# Extract the uid for the mail from the extracted Delivered-To: header line
UID=substr($DELTO,$USTART,$ULENGTH)
# I'm also curious about this line, it seemed kind of odd to put
NewDELTO="$UID$DTLD"
# Construct a new delivered to string
NewDELTO="${UID}${DTLD}"
#Then insert the new delivered to header:
xfilter "/usr/local/maildrop/bin/reformail -i \"Delivered-To: $NewDELTO\""
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf