first thanks for all the hints and tips
after i have studied RFC1521 fixed some problems
with demime tweaking stripmime lerning about
makemime and reformime from the dropmail pakage
i finally puzzled something together
the ups are it is working:)
the downs are that i need to know every mime
attachment type who is possible
i need to understand how i can make a procmail recipe
who recursive reads out all Content-Type: fields from tthe Body
exept text/plain and text/html
and put the findings in a comma separated list like
application/octet-stream, image/jpeg ......
with this i could use the - i parameter from
stripmime.pl to rescue all attachments.
if someone could help me on that would be nice
other comments highly welcome !!
*****
i am shure there will be other ways to do it but ....
VERBOSE = ON
#saving a copy just in case of error :)
:0 c:
/var/mail/test
#thanks to BART :)
:0
* 9876543210^0 Content-Type(.|$[ ])*boundary="\/[^"]+
* 9876543210^0 Content-Type(.|$[ ])*boundary=\/[^; ]+
{ BOUNDARY=$MATCH }
#make shure there is something in BOUNDARY
:0
* ! BOUNDARY ?? .
{ BOUNDARY = "xyz123789klopqrs" }
:0 c w
{
#make shure /tmp/tmp.000 exist and is empty
:0 w
* ? ( echo "" > /tmp/tmp.000 )
{ X="" }
#get the TEXT or the to TEXT formated HTML part
:0 fw
|/usr/local/bin/perl /etc/admin/perlscript/demime.pl -
#removing the email header
:0 fw
|formail -I ""
#make a MIME TEXT part
# and let makemime guess the encoding type
:0 fw
|makemime -c "text/plain;" -o /tmp/tmp.001 -
#tell procmail that this copy has arived its destination
:0
/dev/null
}
#getting a new copy only if the email is multipart
:0 c w
* ^Content-Type:.*multipart
{
#get the MIME parts we like and strip the one we dont
# i left image/gif there to have something to test
# but it could be a comma separated list
# some typs i already hardcoded into stripmime
:0 fw
|/etc/admin/perlscript/stripmime.pl -e text/plain -i image/gif -m -h
:0
/tmp/tmp.000
}
#erasing the body of the original mail
:0 fbw
|cat - > /dev/null
#inserting in the body the first boundary
#and dont add a nl
:0 fbw
|echo -n --$BOUNDARY
#replacing or inserting the Content-Type header
# because we have no multipart/alternativ anymore
#we need a multipart mixed
#regarding RFC1521 a subtype is not mandatory
:0 fhw
|formail -I "Content-Type: multipart/mixed; boundary=\"$BOUNDARY\""
#put it all together an repair missing boundary,
#charactersets and ..... with reformime
:0 fw
|cat - /tmp/tmp.001 /tmp/tmp.000|reformime -r
#deliver it
:0:
/var/mail/test
matthias
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail