Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Program to detach e-mail attachment


Sluggers,

looking for some pointers on getting together some code to auto process incoming e-mails, detach their attachments and save them as files. The MTA is qmail so the appropriate "|myprog" entry in .qmail gets the mail passed to the program then I need to code up something that will take the attachment, detach & decode it and save it as a file.

 The body of the mail arrives like;

----=_Mail_SendEasy_GHPHFaz_39032_1120519077
Content-Type: application/octet-stream; name="4321_20050704.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="4321_20050704.txt"

MjAwNTA3MDMyMTM3NTE4MTAwNUUwMjQ4MDAzODc1QzE3OEVGCjI
(snip)
MjAwNTA3MDQyMzE3MjU4MTAwNUUwQzQ4MDAxODI0MkQ0NDE2Cg==

----=_Mail_SendEasy_GHPHFaz_39032_1120519077--

Not being much of a perl guru but still thinking that's probably the appropriate tool, maybe there's a perl library to decode the mime base64......

anyone have some examples, web pages to go visit...

TIA's

Pete.