[SPAM?] Re: [SPAM?] Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread Mark H. Wood
On Wed, Sep 14, 2016 at 04:12:48PM -0700, Are Troi wrote:
> Hi All,
> 
> Last night at a technical talk I lamented the loss around 5 years ago
> from Fedora of command-line tools to extract email attachments from a
> BASH script and a colleague told me Mutt can do this.

Mutt is a really nice tool, but for this I would probably reach first
for 'reformime' from the maildrop package.  (I'm a long-time maildrop
fan.)

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu


signature.asc
Description: PGP signature


[SPAM?] Re: [SPAM?] Re: [SPAM?] Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread Luis Mochan
On Thu, Sep 15, 2016 at 11:33:41AM +0200, Richard Z wrote:
> On Thu, Sep 15, 2016 at 10:53:02AM +1000, Cameron Simpson wrote:
> > On 14Sep2016 16:12, Are Troi  wrote:
> > > Last night at a technical talk I lamented the loss around 5 years ago
> ...
> tried ripmime and munpak about a year ago to save all attachments from 
> a large MBOX and it was everything but a hasslefree experience. Various 
> attachments were missed or not processed, some segfaults.
> Those tools are apparently not as robust as mutt is.

I have used ripmime without problems but on individual messages from a
Maildir, not on a large mbox.

Luis




[SPAM?] Re: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread Luis Mochan
On Thu, Sep 15, 2016 at 07:55:12AM -0300, Marcelo Laia wrote:
> On 14/09/16 at 08:06pm, Luis Mochan wrote:
>  
> > Maybe you could use the program 'ripmime' directly from bash. I found
> > it in the debian repositories. I use it manually through a mutt macro
> > 
> > macro index Ys "| ~/.mutt/saveattachments\n" "Save attachments"
> > 
>  
> Hi, I try to use your script, nut, when I hint Y, mutt tell me that "Key Y is
> not mapped"
You should first define the macro! You could do it interactively (for
testing purposes) by typing : (colon) followed by the macro definition
above, i.e.,
  :macro index Ys...
by making a text file whose content is the macro definition and
sourcing it from mutt
  :source filename.txt
or by adding it to you ~/.mutt/muttrc file so that it is loaded
automatically on the next mutt startup. Afterwards, you should be
able to call the macro when you are in the 'index' view. You could
replace Ys to the key sequence of your choice to call the macro. 

> 
> What could I doing wrong?
> 
> -- 
> Marcelo
> 

-- 

  o
W. Luis Mochán,  | tel:(52)(777)329-1734 /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388 `>/   /\
Apdo. Postal 48-3, 62251 |   (*)/\/  \
Cuernavaca, Morelos, México  | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB




[SPAM?] Re: [SPAM?] Re: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread Marcelo Laia
On 14/09/16 at 08:06pm, Luis Mochan wrote:
 
> Maybe you could use the program 'ripmime' directly from bash. I found
> it in the debian repositories. I use it manually through a mutt macro
> 
> macro index Ys "| ~/.mutt/saveattachments\n" "Save attachments"
> 
 
Hi, I try to use your script, nut, when I hint Y, mutt tell me that "Key Y is
not mapped"

What could I doing wrong?

-- 
Marcelo


Re: [SPAM?] Re: [SPAM?] Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread Richard Z
On Thu, Sep 15, 2016 at 10:53:02AM +1000, Cameron Simpson wrote:
> On 14Sep2016 16:12, Are Troi  wrote:
> >Last night at a technical talk I lamented the loss around 5 years ago
> >from Fedora of command-line tools to extract email attachments from a
> >BASH script and a colleague told me Mutt can do this.
> 
> If you mean the MIME tools mpack and munpak, I still use them. (On a Mac,
> where the Macports package is called mpack).
> 
> Wouldn't you be better off just fetching and buiulding them?

tried ripmime and munpak about a year ago to save all attachments from 
a large MBOX and it was everything but a hasslefree experience. Various 
attachments were missed or not processed, some segfaults.
Those tools are apparently not as robust as mutt is.

Ended up splitting the MBOX by formail 
  cat MBOX | formail -ds sh -c 'cat > msg.$FILENO'
and processing messages by 
  ripmime -v  --name-by-type --verbose-contenttype --verbose-defects  -i "$f"
.. and hoping not much was missed by this apporach.

Richard

-- 
Name and OpenPGP keys available from pgp key servers



[SPAM?] Re: [SPAM?] Re: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-15 Thread David Champion
* On 14 Sep 2016, Cameron Simpson wrote: 
> On 14Sep2016 18:35, David Champion  wrote:
> 
> Just an aside, now often do you encounter "/" in a Message-ID? It is legal,
> and has long discouraged me from the otherwise obvious and inuitive
> name-a-file-after-the-message-id.
> 
> > #!/usr/bin/env python
> [...]
> 
> That is very nice, even cleaner than I imagined it might be.

Thanks - yes, my intention was just to demo the approach. I've done
a few MIME walks in Python so this was a simple modification of some
existing code. Even with many years of mutt experience I think rolling
this up last night was faster than getting something steady and sturdy
going with mutt macros, and I have more confidence in it.

There's certainly room to improve if anyone wants to take this further,
and you've raised a good point above. A few things ought to be sanitized
more.

-- 
David Champion • d...@bikeshed.us


signature.asc
Description: PGP signature