Using Munpack to extract attachments of specific file type (Debian/Squeeze)

7,340

unfortunately, U'll probably have to re-write munpack to add the capability of unpacking multiple files. according to a README that came with v1.5 source, "[t]here must be exactly one message per file. Munpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins."

i don't know how difficult that re-write would be, as i haven't looked at the source myself; i'm perfectly happy splitting files (use GAWK or PERL or something like that) on the boundaries.

Share:
7,340

Related videos on Youtube

Spartanblogger
Author by

Spartanblogger

Updated on September 18, 2022

Comments

  • Spartanblogger
    Spartanblogger almost 2 years

    I configured Munpack on my Debian/Linux to extract attachments from incoming emails.

    (For additional context, Getmail fetches the emails and pipes it to Procmail. A Procmail recipe then pipes it to Munpack.)

    | munpack -q -C directory/
    

    For some reason, when I get emails with (a) inline attachments (usually images) AND (b) document attachments (usually .csv), the .csv files are completely ruined.

    (Note that this issue doesn't arise when there is only one attachment, which typically is a .xls file.

    Is there a way to configure Munpack to:

    1. Save **ONLY** attachments with the `.csv` extension in the email.
    
    2. Make sure that the **.csv** files are saved as is.
    
  • Stuart Axon
    Stuart Axon almost 6 years
    Given that munpack is from the early 90s and you have it as a reference, rewriting would probably be much easier than writing it in the first place. I've only just discovered munpack, but two things seems painful - 1 - it renames attachments with spaces. 2. - no way of listing messages and attachments from the commandline.