|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Extract all attachments from unix mailbox file
Hi guys,
I wondering if someone already wrote a script for this, it looks easy for the first shot but I would say it's a bit advanced. I want to extract all my email attachments from /var/mail/username (Unix mail format) + from my local mails (Maildir format) to a directory with the original filename, and rename it automatically if 2 attachments have the same name. Thunderbird has an extension for it but I would like to do it with shellscript. If noone knows script for this (tried googling of course) then I write my own. Pbly sed would be sufficient to process the whole mailbox file and find the attachments as records. Thanks Last edited by raynor; 06-24-2008 at 01:21 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Quote:
Code:
find dir containing files | while read file; do create tempdir and copy file there run munpack on file and copy attachments elsewhere destroy tempdir (contents) done |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Something similar here...
Perl script to save an email attachment to disk - -General UNIX discussion FAQ - Tek-Tips |
|
#4
|
|||
|
|||
|
thx
Hi,
Thanks for the answers. Actually both of you give an answer which is part of the solution. I was thinking that someone must wrote a tool like munpack for it. The only problem with munpack that it can't process a single mailbox file, eg: thunderbird's inbox. It only works if I make a test.txt which containst only a single mail which starts with: From <sender> Mon Jun 16 20:42:11 2008 ... and ends with --------------=CODE-- So I still have to cut this file apart to single mails in order to extract the attachments from them but I can do it from here. Thx guys. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Yeah, I read over that in your OP. You could automate separating e-mails and processing them individually with munpack using a procmail recipe.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| unix email attachments in web mail | gi.srinivas | Shell Programming and Scripting | 10 | 02-29-2012 01:57 PM |
| Aix Unix Mailx Attachments | darioa | AIX | 3 | 01-07-2009 12:09 PM |
| Reading a mailbox and sending new messages to a text file | rsw626 | Shell Programming and Scripting | 1 | 04-17-2008 01:35 PM |
| sending attachments via unix | Abhishek Ghose | UNIX for Advanced & Expert Users | 6 | 09-30-2005 04:49 PM |
| Mailbox file format | exile | UNIX for Advanced & Expert Users | 1 | 09-18-2001 09:44 AM |
|
|