Saving Attachments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Saving Attachments

@lbutlr
I have an account that mostly receives automated emails with attachments. I would like to save those attachments outside of the mail/IMAP area and then add a link (in the headers) to the saved attachment in the original mail.

I do not need to strip the attachment from the email.

I’ve looked at 10-mail.conf. but I am using Maildir and I do not want to alter the email other than adding a header like X-Local-link: URL://server/path/to/file

If mdbox or sdbox are the only options for this, can I specify that for a single user account instead of for all my users?

My other idea was to break out my old ripmime script that I wrote for procmail and do something in sieve like

if anyof (header :contains [“content-type"] [ “multiupart”, “other types”]) {
        fileinto :create “TempAttach”;
        }

And then let ripmime loose on .TempAttach/new/ via a periodic cron job knowing the message would end up being filed in whatever default mailbox after the copy was dropped in the temp mail, but that doesn’t get me the added header with the link to the attachment without a lot of work. I suppose I could generate a second mail with the details of the attachment (size, name, sender, date). Not ideal.

Suggestions?



--
No one ever thinks of themselves as one of Them. We're always one of
        Us. It's Them that do the bad things.