6

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.
2

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.

1
  • 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. – Stuart Axon Aug 10 '18 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.