I am trying to write a recipe that will do two things: change the name of
an attachment (abc.exe => abc.exe.fixed) and insert a line of text into the
email message to inform the user. The first part of my recipe works fine.
However, lines are added after the last boundary line and doesn't show up
as part of the message.
-----PROCMAILRC------
#Executable protection
LOGFILE=/etc/proclog
VERBOSE=yes
REPLY_FILE=/etc/security-notice
SENDMAIL=/usr/sbin/sendmail
USER=${USER:-$LOGNAME}
:0
DATE=| formail -zX'Date' | sed -e 's/["~]//g'
DATE="${DATE:-'(no date)'}"
:0
FROM=| formail -zX'From' | sed -e 's/["~]//g'
FROM="${FROM:-'(no from)'}"
:0
SUBJ=| formail -zX'Subject:' | sed -e 's/["~]//g'
SUBJ="${SUBJ:-'(no subject)'}"
:0 BH
* $ ^Content-Disposition: attachment
* (\.exe|\.com|\.vbs|\.scr|\.bat)
{
:0 fbw
|/bin/sed -e 's/\(name=".*.exe\)"/\1.fixed"/'
:0 fbw
|/bin/sed -e 's/\(name=".*.com\)"/\1.fixed"/'
:0 fbw
|/bin/sed -e 's/\(name=".*.vbs\)"/\1.fixed"/'
:0 fbw
|/bin/sed -e 's/\(name=".*.scr\)"/\1.fixed"/'
:0 fbw
|/bin/sed -e 's/\(name=".*.bat\)"/\1.fixed"/'
:0 f
| cat - ; echo "=== Attachment name changed ==="
:0
${DEFAULT}
}
------resulting mail message------
neo2:/etc> more /var/spool/mail/root
From root(_at_)loyno(_dot_)edu Thu Apr 4 16:16:42 2002
Return-Path: <root(_at_)loyno(_dot_)edu>
Received: from nadal.loyno.edu (loyno.edu [141.164.24.217] (may be forged))
by neo2.loyno.edu (AIX5.1/8.11.0/8.11.0) with ESMTP id g34MGfM466946
for <root(_at_)neo2(_dot_)loyno(_dot_)edu>; Thu, 4 Apr 2002 16:16:41
-0600
Received: from neo2 (neo2 [141.164.25.215] (may be forged))
by nadal.loyno.edu (AIX5.1/8.11.0/8.11.0) with ESMTP id
g34MCTP3727520
for <root(_at_)neo2(_dot_)loyno(_dot_)edu>; Thu, 4 Apr 2002 16:12:29
-0600
Date: Thu, 4 Apr 2002 16:16:41 -0600 (CST)
From: root(_at_)loyno(_dot_)edu
To: root(_at_)neo2(_dot_)loyno(_dot_)edu
Subject: test.exe
Message-ID:
<Pine(_dot_)A41(_dot_)4(_dot_)43(_dot_)0204041616280(_dot_)499918-101000(_at_)neo2(_dot_)loyno(_dot_)edu>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
BOUNDARY="-1918625321-1879308689-1017958601=:499918"
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime(_at_)docserver(_dot_)cac(_dot_)washington(_dot_)edu for more
info.
---1918625321-1879308689-1017958601=:499918
Content-Type: TEXT/PLAIN; charset=US-ASCII
test.exe
---1918625321-1879308689-1017958601=:499918
Content-Type: APPLICATION/octet-stream; name="test.exe.fixed"
Content-Transfer-Encoding: BASE64
Content-ID:
<Pine(_dot_)A41(_dot_)4(_dot_)43(_dot_)0204041616410(_dot_)499918(_at_)neo2(_dot_)loyno(_dot_)edu>
Content-Description:
Content-Disposition: attachment; filename="test.exe.fixed"
---1918625321-1879308689-1017958601=:499918--
=== Attachment name changed ===
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail