Script to delete attachments?

Script to delete attachments?

Post by Clint Harr » Fri, 15 Nov 1996 04:00:00



Does anyone have a script that will delete attachments in mail messages leaving only the text of the message behind?

Thanks,
Clint

 
 
 

Script to delete attachments?

Post by era erikss » Tue, 26 Nov 1996 04:00:00


[This message was sent by private mail as well as posted to Usenet]


to comp.unix.shell:
 > Does anyone have a script that will delete attachments in mail
 > messages leaving only the text of the message behind?

This one is out of my .procmailrc; it only does a selected kill of
certain kinds of attachments, but that is probably safer than just
kill'em all. Adapt to suit your needs. (Everything up to the "|" is
Procmail-specific but from there on, it's just a shell script.)

:0fbw  # f = pipe  b = message body  w = wait for pipe to finish
* ^Content-Type: multipart/mixed; boundary=
| (echo '\
X-Mime-Note:       <<< MIME attachments removed >>>'; \
   sed -e "/^Content-Type: application\//,/^\-\-/d" \
       -e "/^begin 600 WINMAIL\.DAT/,/^end$/d" )

This was originally written for a very old version of Procmail and
could probably be made much neater. I haven't bothered. One thing you
might want to do is to make the resulting output MIME-compliant; this
one will leave a bit of headers behind but my main purpose was just to
get rid of the offensive bulk of the crock people think they can fill
my mailbox with.

Hope this helps,

/* era */

--
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
  at the following URL:  <http://www.ling.helsinki.fi/~reriksso/spam.html>

 
 
 

Script to delete attachments?

Post by Jim Ait » Tue, 26 Nov 1996 04:00:00


:  > Does anyone have a script that will delete attachments in mail
:  > messages leaving only the text of the message behind?

: This one is out of my .procmailrc; it only does a selected kill of
: certain kinds of attachments, but that is probably safer than just
: kill'em all. Adapt to suit your needs. (Everything up to the "|" is
: Procmail-specific but from there on, it's just a shell script.)

Ok, but how does one 're-format' an AmiPro 'attach'?  Short of shooting the
sender?

--
-jim-