Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extract attachments automatically

0 views
Skip to first unread message

Richard Kalsky

unread,
Jul 23, 2002, 8:47:13 AM7/23/02
to
Here is my task with Postfix on SuSE Linux 7.1 eMail Server 3.0:

I have an email account called "orders" at RoyalPetSupplies . com

The emails are stored in /var/spool/imap/users/orders/ and are numeric files
for each email message. (ex. "523.", "623.")

I need to extract all attachments sent (either "quoted-printable" OR
"base64" OR whatever) to a directory called "/mnt/smb".

I have spent over 2 days working on this, and can not create a suitable
solution. I have tried to use procmail, formail and
mimencode/uudecode/uudeview but can not create a recipe that will process
just the attachments to that directory. Any help??? A sample recipe, and/or
any advice (with web URLs preffered) would be great. Thanks.

those who know me have no need of my name

unread,
Jul 23, 2002, 2:06:33 PM7/23/02
to
in comp.mail.misc i read:

>The emails are stored in /var/spool/imap/users/orders/ and are numeric
>files for each email message. (ex. "523.", "623.")
>
>I need to extract all attachments sent (either "quoted-printable" OR
>"base64" OR whatever) to a directory called "/mnt/smb".

at the simplest:

munpack -C /mnt/smb /var/spool/imap/users/orders/[0-9]*.

you probably need a way to prevent yourself from decoding a message twice,
e.g.,

[warning: untested]

header="X-Decoded-By-Us: foo"
for f in /var/spool/imap/users/orders/[0-9]*.
do
grep -q "^${header}" ${f} && continue
formail -i"${header}" ${f} > ${f}tmp || continue
munpack -q -C /mnt/smb $f && cat ${f}tmp > ${f}
rm -f ${f}tmp
done

--
bringing you boring signatures for 17 years

s. keeling

unread,
Jul 26, 2002, 11:38:08 AM7/26/02
to
On Tue, 23 Jul 2002 08:47:13 -0400, Richard Kalsky <rka...@royalpetsupplies.com>:

Maybe something like this?

# ------------------------------------
# throw away win attachments.
#
# we...@gmx.li and procmail mailing list, 3May2001.
#
:0 HB
* -1^0
* 1^0 ^Content-Disposition: attachment;
* 1^0 filename=".*\.(exe|com|bat|hta|lnk|mdb|mus|pif|scr|vbs|wav)"
{
:0
{ RULE="Windows Attachments" }
:0
/dev/null
}


And see the procmail-users mailing list archives.


--
Any technology distinguishable from magic is insufficiently advanced.
(*) TopQuark Software & Services. Contract programmer, server bum.
- - Give up Spammers; I use procmail.
How to quote: http://learn.to/quote (Ger.) http://quote.6x.to (Eng.)

0 new messages