Re: pdf attachments opened in external viewer

2023-08-15 Thread Max Görner

Hi,

I cannot recall the exact explanations, but when I set up external viewers for
mutt I found that I had to use a program called `mutt_bgrun` that would detach
the started viewers. It creates a temporary directory, copies the file into it
and opens the viewer on that copy. It works flawlessly, only HTML attachments
opened in Firefox do not reload. You may find mg_bgrun attached. Don't forget
to make it executable after placing it somewhere.

In order to make use of it, I have a `mailcap` file residing in `.mutt`, which
specifies how a number of file types should be opened. Instead of using
the viewer directly, one has to prefix the command line with the path to
`mutt_bgrun`. Due to lazyness I attach my complete `mailcap` file and not some
excerpt.

In order to make use of this `mailcap`, you need to add

set mailcap_path = "~/.mutt/mailcap"

to your `muttrc`.

That should be it.


Best,
Max Görner
#!/bin/sh
# @(#) mutt_bgrun $Revision: 1.4 $

#   mutt_bgrun - run an attachment viewer from mutt in the background
#   Copyright (C) 1999-2002 Gary A. Johnson
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# SYNOPSIS
#   mutt_bgrun viewer [viewer options] file
#
# DESCRIPTION
#   Mutt invokes external attachment viewers by writing the
#   attachment to a temporary file, executing the pipeline specified
#   for that attachment type in the mailcap file, waiting for the
#   pipeline to terminate, writing nulls over the temporary file,
#   then deleting it.  This causes problems when using graphical
#   viewers such as qvpview and acroread to view attachments. 
#
#   If qvpview, for example, is executed in the foreground, the mutt
#   user interface is hung until qvpview exits, so the user can't do
#   anything else with mutt until he or she finishes reading the
#   attachment and exits qvpview.  This is especially annoying when
#   a message contains several MS Office attachments--one would like
#   to have them all open at once. 
#
#   If qvpview is executed in the background, it must be given
#   enough time to completely read the file before returning control
#   to mutt, since mutt will then obliterate the file.  Qvpview is
#   so slow that this time can exceed 20 seconds, and the bound is
#   unknown.  So this is again annoying. 
#
#   The solution provided here is to invoke the specified viewer
#   from this script after first copying mutt's temporary file to
#   another temporary file.  This script can then quickly return
#   control to mutt while the viewer can take as much time as it
#   needs to read and render the attachment. 
#
# EXAMPLE
#   To use qvpview to view MS Office attachments from mutt, add the
#   following lines to mutt's mailcap file.
#
#   application/msword; mutt_bgrun qvpview %s
#   application/vnd.ms-excel;   mutt_bgrun qvpview %s
#   application/vnd.ms-powerpoint;  mutt_bgrun qvpview %s
#
# AUTHOR
#   Gary A. Johnson
#   
#
# ACKNOWLEDGEMENTS
#   My thanks to the people who have commented on this script and
#   offered solutions to shortcomings and bugs, especially Edmund
#   GRIMLEY EVANS  and Andreas Somogyi
#   .

prog=${0##*/}

# Check the arguments first.

if [ "$#" -lt "2" ]
then
echo "usage: $prog viewer [viewer options] file" >&2
exit 1
fi

# Separate the arguments.  Assume the first is the viewer, the last is
# the file, and all in between are options to the viewer.

viewer="$1"
shift

while [ "$#" -gt "1" ]
do
options="$options $1"
shift
done

file=$1

# Create a temporary directory for our copy of the temporary file.
#
# This is more secure than creating a temporary file in an existing
# directory.

umask 077
tmpdir=$(mktemp -d --tmpdir)
[ -d "$tmpdir" ] || exit 1
tmpfile="$tmpdir/${file##*/}"

# Copy mutt's temporary file to our temporary directory so that we can
# let mutt overwrite and delete it when we exit.

cp "$file" "$tmpfile"

# Run the viewer in the background and delete the temporary files when done. 

(
"$viewer" $options "$tmpfile"
rm -f "$tmpfile"
 

Re: pdf attachments opened in external viewer

2023-08-15 Thread Anton Sharonov
On Tue, Aug 15, 2023 at 06:03:22AM +0200, Fourhundred Thecat wrote:
> Hello,
> 
> somehow, I got it working, that pdf attachments are opened in external
> viewer (evince). That is very nice.
> 
> But, mutt waits for evince to close, before I can continue working in mutt.
> 
> This prevents me from opening multiple pdf attachments and leave them
> open, while continue working in mutt.
> 
> I guess, I would have to add '&' somewhere, so that evince is opened in
> background ?
> 
> But where?

WARNING: solution posted below is experimental and overkill )))
Just to open PDF in mutt is possible to be done much easier!

But for me defined custom macro "v" in the attach menu working fine
in .muttrc:

  macro attach v |show-on-host

This pipes the full attachment to the stdin of custom command
"show-on-host". This in turn call another custom command "wmexpl".
This constellation has some history in my configuration and
differentiate if something uses the STDIN and another is taking the
existing filename as argument. I do not use embedded detection of
the file type, done by mutt, and call from my "wmexpl" script
"file" utility, because i like to start the files from command line
outside mutt using the same way/scripts. Just to open PDF in mutt
is possible to be done much easier! For me pdf's are normally
opened with "okular" via "kfmclient exec ..." on KDE. For your case
you would need to add support to open pdf-s via "evince" with
something like (untested):

  #~
  sub run_via_evince
  {
my ($fname) = (@_);
system ('evince "' . $fname . '" &') == 0
  or die "failed evince ...: $!";
  }

and modify my PDF handler like this:

-   $ALLOWED=1if ($FTYPE =~ /.*: PDF document, version [0-9.]+( 
\(password protected\))?(, \d+ page\(?s\)?)?( \(zip deflate encoded\))?$/);
+   $handler=\_via_evince if ($FTYPE =~ /.*: PDF document, version [0-9.]+( 
\(password protected\))?(, \d+ page\(?s\)?)?( \(zip deflate encoded\))?$/);

relevant lines from show-on-host:

  #!/usr/bin/perl -w
  use strict;
  use 5.010;
  my $tmp_base_fname = 'show-on-host' . "__guessMeByContent";
  my $tmp_fname = "/tmp/$tmp_base_fname";
  open (MYOUT, '>:raw', $tmp_fname) or die("cant open [$tmp_fname] for write: 
$!");
  while(<>) {
print MYOUT $_;
  }
  close MYOUT;
  system ("cp", $tmp_fname, "/data/sonstiges");
  system ("wmexpl", "/data/sonstiges/$tmp_base_fname");

relevant lines from wmexpl:

  #!/usr/bin/perl -w
  use strict;
  use 5.010;
  #~
  sub run_via_kfmclient
  {
my ($fname) = (@_);
dbg("[run_via_kfmclient]: [$fname]");
system('kfmclient exec "' . $fname . '"') == 0 
  or die "failed to kfmclient exec ...: $!";
  }

  #~
  sub run_via_oo
  {
my ($fname) = (@_);
system ('ooffice "' . $fname . '" &') == 0
  or die "failed ooffice ...: $!";
  }

  #~
  sub guess_handler
  {
my ($FNAME_CMDLINE) = (@_);
my $FTYPE = `file "$FNAME_CMDLINE"`;
dbg ("FTYPE=$FTYPE");
my $ALLOWED = 0;
my $handler = undef;

$ALLOWED=1if ($FTYPE =~ /.*: PDF document, version [0-9.]+( 
\(password protected\))?(, \d+ page\(?s\)?)?( \(zip deflate encoded\))?$/);
$handler=\_via_oo if ($FTYPE =~ /.*: Microsoft Word [0-9+]+$/);
$handler=\_via_oo if ($FTYPE =~ /.*: Microsoft OOXML$/);
$ALLOWED=1if ($FTYPE =~ /[^:]+: JPEG image data,/);
$ALLOWED=1if ($FTYPE =~ /[^:]+: PNG image data,/);
#HTML document, ASCII text, with very long lines (559)
$ALLOWED=1if ($FTYPE =~ /[^:]+: HTML document(, ASCII text)?(,( 
UTF-8)? Unicode text)?(, with very long lines( \(\d+\))?)?(, UTF-8 text)?$/); # 
too restrictive?
$handler=\_via_oo if ($FTYPE =~ /[^:]+: Microsoft Excel [0-9+]+$/);
$handler=\_via_oo if ($FTYPE =~ /[^:]+: OpenDocument Spreadsheet$/);
$handler=\_via_oo if ($FTYPE =~ /[^:]+: Microsoft PowerPoint [0-9+]+$/);
$ALLOWED=1if ($FTYPE =~ /[^:]+: PostScript document text 
conforming DSC level 3.0$/);

if ($ALLOWED && !defined($handler)) {
  $handler = \_via_kfmclient;
}

return ( $handler, $FTYPE );

  }

  sub unix_wmexpl
  {
my ($FNAME_CMDLINE) = (@_);
my ($handler,$ftype) = _handler($FNAME_CMDLINE);
if (defined($handler))
{
  &{$handler}($FNAME_CMDLINE);
}
else
{
  die "handler is not defined";
}
  }

  $FNAME_CMDLINE = $ARGV[0]//".";
  _wmexpl($FNAME_CMDLINE);

With best regards, Anton


pdf attachments opened in external viewer

2023-08-14 Thread Fourhundred Thecat

Hello,

somehow, I got it working, that pdf attachments are opened in external
viewer (evince). That is very nice.

But, mutt waits for evince to close, before I can continue working in mutt.

This prevents me from opening multiple pdf attachments and leave them
open, while continue working in mutt.

I guess, I would have to add '&' somewhere, so that evince is opened in
background ?

But where?


Re: Forward with attachments

2023-04-27 Thread Sam Kuper
On Thu, Apr 27, 2023 at 11:28:32AM -0400, Ofer Inbar wrote:
> These days I usually do it by hitting 'v' on the original, separately
> saving the attachments I want as local files, and then re-attaching
> them to my reply or forward.

If you want to save them locally, fair enough.  If not, then after
pressing v you can tag multiple attachments and then press the ; key
(semicolon) followed by the f key.

This will set up a new draft email with the attachments attached.


Re: Forward with attachments

2023-04-27 Thread Ofer Inbar
I'm just writing to say that this is something I've long wished for
from mutt: A very easy to to either forward or reply and include the
same attachments that were attached to the original, as attachments
to my new email (my reply or forward).  These days I usually do it by
hitting 'v' on the original, separately saving the attachments I want
as local files, and then re-attaching them to my reply or forward.
But that's toilsome.
  -- Cos


Re: Forward with attachments

2023-04-24 Thread Jason
On Fri, Apr 21, 2023 at 01:39:07PM -0700, Kevin J. McCarthy wrote:
> On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
> > Is there a configuration that will make mutt's forwarding behavior more
> > like other clients I have used: body is quoted in the message, and
> > attachments are automatically attached?
> > 
> > The options I have tried are:
> > 
> > 1. Regular forward. Attachments are not included.
> 
> $forward_attachments, added in Mutt 1.12.0, will prompt to attach non
> text-decodable attachments.  However, Mutt considers autoview types to be
> text decodable.  $honor_disposition can override this.

Thank you, I hadn't checked this thread for a couple days, but I think that's 
what I was looking for! (My current version is too old to support that, but 
I'll soon be migrating to a platform on which I'll be using version 2.1.5.)


Thanks,
-- 
Jason


Re: Re: Forward with attachments

2023-04-23 Thread John Hawkinson
Jan Eden via Mutt-users  wrote on Sun, 23 Apr 2023 at 
02:42:23 EDT in :

> On 2023-04-22 14:58, Akkana Peck wrote:
> 

> > Thanks: I'd also been trying to find a way to forward with
> > attachments, and $forward_attachments helps as long as there's no
...
> Isn't this what the mime_forward variable is for?

Not...really.

$mime_forward wraps the entire message in a message/rfc-822 attachment, 
preserving the full attachment structure. This is great if the recipient can 
deal with it, and is interested in doing so...sometimes that's not the case. 
Some MUAs have trouble with them, and others make it just a pain to deal with 
opening attachments within attachments. (And these problems increase if there 
is a forwarded message that is then forwarded).

I think what is asked for is to flatten the attachment hierarchy and include 
all attachments as top-level attachments in the forwarded message. This is 
what, e.g., Gmail will do when forwarding. I sometimes want this behavior when 
it's more important to get the message across than to forensically preserve the 
original message. (Although since it often involves HTML, I tend not to use 
mutt to send those kinds of messages, so I'm not sure I would personally find a 
mutt feature to do this all that helpful. But that's just me.)

--
jh...@alum.mit.edu
John Hawkinson


Re: Re: Forward with attachments

2023-04-23 Thread Jan Eden via Mutt-users
On 2023-04-22 14:58, Akkana Peck wrote:

> > On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
> > > Is there a configuration that will make mutt's forwarding behavior more
> > > like other clients I have used: body is quoted in the message, and
> > > attachments are automatically attached?
> 
> Kevin J. McCarthy writes:
> > $forward_attachments, added in Mutt 1.12.0, will prompt to attach non
> > text-decodable attachments.  However, Mutt considers autoview types to be
> > text decodable.  $honor_disposition can override this.
> 
> Thanks: I'd also been trying to find a way to forward with attachments, and 
> $forward_attachments helps as long as there's no HTML part.
> 
> But it still doesn't forward html parts, and setting honor_disposition 
> doesn't change that. Is there a way to forward the same MIME structure as the 
> original message, including html parts? Like what bounce does, except that it 
> makes me the sender and gives me a chance to add a comment?

Isn't this what the mime_forward variable is for?

- Jan


signature.asc
Description: PGP signature


Re: Forward with attachments

2023-04-22 Thread Akkana Peck
> On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
> > Is there a configuration that will make mutt's forwarding behavior more
> > like other clients I have used: body is quoted in the message, and
> > attachments are automatically attached?

Kevin J. McCarthy writes:
> $forward_attachments, added in Mutt 1.12.0, will prompt to attach non
> text-decodable attachments.  However, Mutt considers autoview types to be
> text decodable.  $honor_disposition can override this.

Thanks: I'd also been trying to find a way to forward with attachments, and 
$forward_attachments helps as long as there's no HTML part.

But it still doesn't forward html parts, and setting honor_disposition doesn't 
change that. Is there a way to forward the same MIME structure as the original 
message, including html parts? Like what bounce does, except that it makes me 
the sender and gives me a chance to add a comment?

...Akkana


Re: Forward with attachments

2023-04-21 Thread Kevin J. McCarthy

On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
Is there a configuration that will make mutt's forwarding behavior more 
like other clients I have used: body is quoted in the message, and 
attachments are automatically attached?


The options I have tried are:

1. Regular forward. Attachments are not included.


$forward_attachments, added in Mutt 1.12.0, will prompt to attach non 
text-decodable attachments.  However, Mutt considers autoview types to 
be text decodable.  $honor_disposition can override this.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Forward with attachments

2023-04-18 Thread John Hawkinson
Jason  wrote on Tue, 18 Apr 2023
at 22:18:55 EDT in <20230419021855.7mdssofxkkngo...@abcmailbox.net>:

> I just did. It dumped the plain text file into the new message body
> below the original body text. Not what I want, but admittedly it's

Tangentially, but relatedly, I sometimes wonder at this.

I cannot forget the painful memory of when a person sent me a multimegabyte 
database file (CSV?) and I hit 'r' and replied and said Thanks without looking 
at the quoted message, and had no idea that the entire database file was quoted 
at the bottom of my message.

Well, I noticed it was taking a little more time to actually send than normal, 
and then I was horrified to discover it.

I'm not sure whether this suggests this is a default in need of attention or 
clever heuristics (not that mutt is big on this) or what...

--
jh...@alum.mit.edu
John Hawkinson

> not very often that there would be a plain text attachment.


Re: Forward with attachments

2023-04-18 Thread Jason
On Wed, Apr 19, 2023 at 12:06:20AM +, Sam Kuper wrote:
> On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
> > 3. Open attachment view, tag all attachments including body, do 'tag
> > prefix' then 'forward', and select 'no' when asked whether to send as
> > attachments. This seems to do what I want for the most part, body text
> > is included in body and regular files are attached,
> 
> Last time I checked (admittedly, a long time ago), this was the right
> way to do it.
> 
> Perhaps someone will chime in with some muttrc settings to reduce the
> number of keystrokes needed.
> 
> 
> > although I'm not sure what happens if some of the attachments happen
> > to be plain text files. Will it dump those into the body as well?
> 
> Try it and see :)

I just did. It dumped the plain text file into the new message body below the 
original body text. Not what I want, but admittedly it's not very often that 
there would be a plain text attachment. I believe I had tried earlier with a 
shell script, and that one attached properly as desired.

Thanks,
-- 
Jason



Re: Forward with attachments

2023-04-18 Thread Sam Kuper
On Tue, Apr 18, 2023 at 04:02:36PM -0500, Jason wrote:
> 3. Open attachment view, tag all attachments including body, do 'tag
> prefix' then 'forward', and select 'no' when asked whether to send as
> attachments. This seems to do what I want for the most part, body text
> is included in body and regular files are attached,

Last time I checked (admittedly, a long time ago), this was the right
way to do it.

Perhaps someone will chime in with some muttrc settings to reduce the
number of keystrokes needed.


> although I'm not sure what happens if some of the attachments happen
> to be plain text files. Will it dump those into the body as well?

Try it and see :)


Forward with attachments

2023-04-18 Thread Jason
Hello,

Is there a configuration that will make mutt's forwarding behavior more like 
other clients I have used: body is quoted in the message, and attachments are 
automatically attached?

The options I have tried are:

1. Regular forward. Attachments are not included.

2. Forward as attachment. This attaches the whole multi-part email as a single 
attachment. One of the things I don't like about this is the original body is 
not included in the new message body.

3. Open attachment view, tag all attachments including body, do 'tag prefix' 
then 'forward', and select 'no' when asked whether to send as attachments. This 
seems to do what I want for the most part, body text is included in body and 
regular files are attached, although I'm not sure what happens if some of the 
attachments happen to be plain text files. Will it dump those into the body as 
well?

So I guess basically my question is, how do I get the behavior of #3 without 
going through all the steps of selecting attachments, etc.? I would like to get 
it simplified for less advanced users, and what I've described seems to be the 
default behavior of other clients like Claws Mail and Thunderbird.

Thanks,
-- 
Jason



Re: don't fetch attachments from imap by default

2022-11-17 Thread Josef 'Jeff' Sipek
On Mon, Nov 14, 2022 at 10:49:25 +0100, Christopher Zimmermann wrote:
> Hi,
> 
> mostly I'm only interested in the message text body, not possibly large 
> attachments. Is it possible to configure mutt to not fetch the whole 
> message, but only the text part, so that opening multi-megabyte messages 
> gets faster and using less bandwidth ?

Back in 2016 there was a long-standing ticket [1] to implement imap4 partial
fetch.  I couldn't find equivalent ticket in the gitlab issue tracker [2].

Jeff.

[1] http://dev.mutt.org/trac/ticket/3465
[2] https://gitlab.com/muttmua/mutt/-/issues/


Re: don't fetch attachments from imap by default

2022-11-15 Thread Rasmus Liland
You're welcome.  I just hoped it would 
work ...  I'm just rambling on from my 
perspective on how I weed out odd 
attachments to keep my mbsync:ed [1] 
mailboxes nice and browsable ... 

Best,
Rasmus

[1] http://isync.sourceforge.net


Re: don't fetch attachments from imap by default

2022-11-15 Thread Christopher Zimmermann

On Tue, Nov 15, 2022 at 04:43:46PM +, Rasmus Liland wrote:

Hi!  Sometimes, when there is a large
attachment or a pgp signature that does
not work, I just delete (d) that
attachment in attachment-view (v) before
viewing the message.  But usually I end
up with a completely empty message when
office365 has deleted all the other good
attachments at its end.  Escpecially for
calendar invitations, where I only want
to keep the ical-file, and not the body
text in both html and text in the mime
...  R


Thanks, this sounds nice, but it doesn't work for me. attachment-view 
will also fetch the whole message.


Re: don't fetch attachments from imap by default

2022-11-15 Thread Rasmus Liland
Hi!  Sometimes, when there is a large 
attachment or a pgp signature that does 
not work, I just delete (d) that 
attachment in attachment-view (v) before 
viewing the message.  But usually I end 
up with a completely empty message when 
office365 has deleted all the other good 
attachments at its end.  Escpecially for 
calendar invitations, where I only want 
to keep the ical-file, and not the body 
text in both html and text in the mime 
...  R


signature.asc
Description: PGP signature


Re: don't fetch attachments from imap by default

2022-11-14 Thread 謝晉凡 Hsieh Chin Fan via Mutt-users
> Is it possible to configure mutt to not fetch the whole
> message, but only the text part, so that opening multi-megabyte messages
> gets faster and using less bandwidth ?

I also wonder if Mutt can partially fetch message when opening pager view, 
and stop at "Content-Disposition: attachment".

Here I found related discussion in 2009:
https://www.mail-archive.com/mutt-users@mutt.org/msg38194.html

-- 
謝晉凡 Hsieh Chin Fan | https://topo.tw/about


signature.asc
Description: PGP signature


don't fetch attachments from imap by default

2022-11-14 Thread Christopher Zimmermann

Hi,

mostly I'm only interested in the message text body, not possibly large 
attachments. Is it possible to configure mutt to not fetch the whole 
message, but only the text part, so that opening multi-megabyte messages 
gets faster and using less bandwidth ?



Christopher


Take over existing attachments as "Attach: " pseudo-headers

2022-06-18 Thread Anton Sharonov
Hi all,

Using long time $edit_headers option, just discovered lovely
"Attach: " pseudo header, which makes it easy to specify new
attachments during message body edit.

However it works just one-way - once editor is finished, those
pseudo-headers are processed somehow and added to "official"
attachment list maintained inside compose menu. Subsequent call
of editor from compose menu is made without any "Attach: "
pseudo-headers (even though compose menu keeps track of
attachments already specified between editor calls).

Just curious: is there a way to somehow feed editor with
attachments, known on the level of compose menu so far, which
would map to set of such "Attach: " pseudo headers during message
edit? (did not found any appropriate setting in mutt
documentation so far).

cheers,
Anton


Re: Default path for saving attachments?

2022-02-17 Thread José María Mateos

On Thu, Feb 17, 2022 at 07:01:52PM +0100, li...@2ion.de wrote:

On Thu, Feb 17, 2022 at 12:35:32PM -0500, José María Mateos wrote:

I'd like to know if there's any config variable to set the destination folder
for saved attachments. I know the workaround is to start mutt in a different
place, but I'd prefer the config option.


Check out the $attach_save_dir configuration option [1].

[1] https://man.archlinux.org/man/muttrc.5#attach_save_dir


Thank you and Jean Louis, this is exactly what I was looking for, but it 
looks like it's still not available in the version I'm using (1.9.4 on 
Ubuntu 18.04). I'm glad to know it exists, though.


--
José María (Chema) Mateos || https://rinzewind.org


Re: Default path for saving attachments?

2022-02-17 Thread Jean Louis
* José María Mateos  [2022-02-17 20:42]:
> Hi all,
> 
> When I want to save an attachment, the default path is the path where mutt
> was launched (typically my home folder). I'd like to know if there's any
> config variable to set the destination folder for saved attachments. I know
> the workaround is to start mutt in a different place, but I'd prefer the
> config option.

set attach_save_dir="~/Downloads/mutt-attachments"


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/


Re: Default path for saving attachments?

2022-02-17 Thread José María Mateos

On Thu, Feb 17, 2022 at 06:47:44PM +0100, Francesco Ariis wrote:

I have macros like

   macro attach D ~/download/
   macro attach T /tmp/

to save to different folder. Would that do?


It'd definitely work, but I'd like to know if there's some way to change 
the default behaviour through a config option.


Thanks!

--
José María (Chema) Mateos || https://rinzewind.org


Re: Default path for saving attachments?

2022-02-17 Thread lists
On Thu, Feb 17, 2022 at 12:35:32PM -0500, José María Mateos wrote:
> I'd like to know if there's any config variable to set the destination folder
> for saved attachments. I know the workaround is to start mutt in a different
> place, but I'd prefer the config option.

Check out the $attach_save_dir configuration option [1].

[1] https://man.archlinux.org/man/muttrc.5#attach_save_dir


Re: Default path for saving attachments?

2022-02-17 Thread Francesco Ariis
Hello José

Il 17 febbraio 2022 alle 12:35 José María Mateos ha scritto:
> When I want to save an attachment, the default path is the path where mutt
> was launched (typically my home folder). I'd like to know if there's any
> config variable to set the destination folder for saved attachments.

I have macros like

macro attach D ~/download/
macro attach T /tmp/

to save to different folder. Would that do?
—F


Default path for saving attachments?

2022-02-17 Thread José María Mateos

Hi all,

When I want to save an attachment, the default path is the path where 
mutt was launched (typically my home folder). I'd like to know if 
there's any config variable to set the destination folder for saved 
attachments. I know the workaround is to start mutt in a different 
place, but I'd prefer the config option.


Thanks,

--
José María (Chema) Mateos || https://rinzewind.org


Re: Tagging attachments - works but no indicator

2021-12-01 Thread Chris Green
On Wed, Dec 01, 2021 at 09:44:47AM -0800, Kevin J. McCarthy wrote:
> On Wed, Dec 01, 2021 at 04:02:15PM +, Chris Green wrote:
> > But, unlike in the index view, tagging doesn't mark the tagged
> > attachments in any way so with a long list and/or if you only want to
> > attach some files from a long list it's a bit awkward.
> 
> $folder_format by default contains the %t expando to indicate tagged
> entries.  Perhaps you've changed the value of that variable?
> 
Ah, yes, obvious really.  I have folder_format set and it hasn't got
%t in it.  It was changed many moons ago to make it briefer than the
default and I left out the %t (for no good reason except ignorance).

Thank you!

-- 
Chris Green


Re: Tagging attachments - works but no indicator

2021-12-01 Thread Kevin J. McCarthy

On Wed, Dec 01, 2021 at 04:02:15PM +, Chris Green wrote:
But, unlike in the index view, tagging doesn't mark the tagged 
attachments in any way so with a long list and/or if you only want to 
attach some files from a long list it's a bit awkward.


$folder_format by default contains the %t expando to indicate tagged 
entries.  Perhaps you've changed the value of that variable?


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Tagging attachments - works but no indicator

2021-12-01 Thread Chris Green
I was about to ask how one could select a series of (for example)
pictures in a directory as attachments rather than having to 'a' each
one.

However, on trying it, I discovered that tagging the attachments and
then hitting Return on the last tagged attachment does attach all the
files selected with 't'.  Good! :-)

But, unlike in the index view, tagging doesn't mark the tagged
attachments in any way so with a long list and/or if you only want to
attach some files from a long list it's a bit awkward.

Is this a bug or an enhancement request?

I'm running mutt version 2.0.5 on xubuntu 21.10.

-- 
Chris Green


Re: Is there any way to print attachments such as PDF files?

2021-05-03 Thread Andy Spiegl
> application/pdf; pdftotext --text %s; copiousoutput;

I prefer this actually:

---
application/pdf; pdftotext -layout -nopgbrk -q '%s' - ; copiousoutput; 
description=PDF; nametemplate=%s.pdf
application/x-pdf; pdftotext -layout -nopgbrk -q '%s' - ; copiousoutput; 
description=PDF; nametemplate=%s.pdf
---

Thanks,
 Andy


-- 
 Maintenance-free:  When it breaks, it can't be fixed...


Re: Is there any way to print attachments such as PDF files?

2021-04-30 Thread D.J.J. Ring, Jr.
For command line users, there is pdftotext available.
https://www.tutorialspoint.com/unix_commands/pdftotext.htm
A suitable entry in mailcap would enable its use.

## Plain text
text/plain; gedit %s; test=RunningX;
text/plain; nano %s;
#
## Images
image/bmp; fbi %s;
image/gif; fbi %s;
image/jpeg; fbi %s;
image/png; fbi %s;
image/tiff; fbi %s;
image/webp; fbi %s;
#
## Formatted Documents
application/msword; antiword -f %s; copiousoutput;
application/vnd.openxmlformats-officedocument.wordprocessingml.document;
docx2txt.sh %s; copiousoutput;
application/rtf; unrtf --text %s; copiousoutput;
application/pdf; pdftotext --text %s; copiousoutput;

David


Re: Is there any way to print attachments such as PDF files?

2021-04-19 Thread Mark H. Wood
On Fri, Apr 16, 2021 at 01:02:39PM -0600, Paul Gilmartin via Mutt-users wrote:
> On 2021-04-16, at 12:28:17, Chris Green wrote:
> > 
> > As per subject, is there any easy way to print attachments such as PDF
> > files?  Hitting 'p' against an attachment just says "I don't know how
> > to print that".  Is there any way to tell mutt how to print it which
> > will also allow printing of plain text as normal.
> >  
> Can mailcap entries handle that, or is mailcap solely for viewing?
> Is there a PDF viewer with a Print command?

From my ~/.mailcap:

application/pdf; \
/usr/bin/atril %s; \
description=Portable Document Format document; \
test=test $DISPLAY; \
nametemplate=%s.pdf; \
print=/usr/bin/lpr %s;

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


Re: Is there any way to print attachments such as PDF files?

2021-04-16 Thread Paul Gilmartin via Mutt-users
On 2021-04-16, at 12:28:17, Chris Green wrote:
> 
> As per subject, is there any easy way to print attachments such as PDF
> files?  Hitting 'p' against an attachment just says "I don't know how
> to print that".  Is there any way to tell mutt how to print it which
> will also allow printing of plain text as normal.
>  
Can mailcap entries handle that, or is mailcap solely for viewing?
Is there a PDF viewer with a Print command?

-- gil



Re: Is there any way to print attachments such as PDF files?

2021-04-16 Thread Chris Green
On Fri, Apr 16, 2021 at 09:07:39PM +0200, Anders Damsgaard wrote:
> * Chris Green  [2021-04-16 19:28:17 +0100]:
> 
> > As per subject, is there any easy way to print attachments such as PDF
> > files?  Hitting 'p' against an attachment just says "I don't know how
> > to print that".  Is there any way to tell mutt how to print it which
> > will also allow printing of plain text as normal.
> > 
> Hi Chris,
> 
> Just pipe the file to 'lpr -P PDF'.  Optionally, add a keybind to do so.
> If you want to get fancy, you can make a shell script which detects the
> mime type, e.g. using `file -ib`, and takes action accordingly.
> 
Of course, obvious really, thank you.

-- 
Chris Green


Is there any way to print attachments such as PDF files?

2021-04-16 Thread Chris Green
As per subject, is there any easy way to print attachments such as PDF
files?  Hitting 'p' against an attachment just says "I don't know how
to print that".  Is there any way to tell mutt how to print it which
will also allow printing of plain text as normal.

-- 
Chris Green


Re: Deleting Attachments from Index View

2021-04-15 Thread John Hawkinson
The IMAP FETCH command allegedly supports retrieving individual sections of a 
message, including the headers and parsed sections of the body based on MIME 
parts. I have no idea what the support for this feature is like.

--
jh...@alum.mit.edu
John Hawkinson


Re: Deleting Attachments from Index View

2021-04-15 Thread No Suck
2021-04-15 0:53 GMT-04:00, Matthias Apitz :
> I now even think, there is no other way, because the attachments are in
> a sequence in the mail body, separated by some describing head lines,
> and mutt must read the full body to present them.

Good point.  In that case, the delete-entry command in the attachment
menu context could technically be called a modify-body command.  I am
not familiar with IMAP but might have surmised it provided commands for
simply deleting attachments.  That is probably not the case.

Thank you for the helpful responses.


Re: Deleting Attachments from Index View

2021-04-14 Thread Matthias Apitz
El día miércoles, abril 14, 2021 a las 09:42:00p. m. -0400, No Suck escribió:

> Thank you for the idea.  Unfortunately, testing with a bandwidth monitor
> (nethogs) shows that mutt downloads all attachments upon executing
> view-attachments from the index view.  Can anyone confirm this?  ...

Correct. I did a test with a mail with a 5 MB attachment over IMAPS.
The view-attachments downloads the attachments before presenting the
overview. I now even think, there is no other way, because the
attachments are in a sequence in the mail body, separated by some
describing head lines, and mutt must read the full body to present them.

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
¡Con Cuba no te metas!  «»  Don't mess with Cuba!  «»  Leg Dich nicht mit Kuba 
an!
http://www.cubadebate.cu/noticias/2020/12/25/en-video-con-cuba-no-te-metas/


Re: Deleting Attachments from Index View

2021-04-14 Thread No Suck
Thank you for the idea.  Unfortunately, testing with a bandwidth monitor
(nethogs) shows that mutt downloads all attachments upon executing
view-attachments from the index view.  Can anyone confirm this?  By the
way, I connect by executing change-folder with the following target:

imaps://sunnycemet...@gmail.com@imap.gmail.com/INBOX


Re: Deleting Attachments from Index View

2021-04-14 Thread Matthias Apitz
El día miércoles, abril 14, 2021 a las 01:32:15a. m. -0400, 
sunnycemet...@gmail.com escribió:

> Hello, everyone.  I would like to save bandwidth.  If an email has a large
> attachment that I know I do not need, is it possible to delete the
> attachment from mutt's index view and *then* open (download) the message
> body?  I found no such command in mutt's documentation.
> 

I think, if you use from the Index the command 'v' and them move down to
the attachment in question and type 'd' for deletion and go back with
'q' to the Index and then sync with '$', the mail will not be down
loaded.

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
¡Con Cuba no te metas!  «»  Don't mess with Cuba!  «»  Leg Dich nicht mit Kuba 
an!
http://www.cubadebate.cu/noticias/2020/12/25/en-video-con-cuba-no-te-metas/


Deleting Attachments from Index View

2021-04-13 Thread sunnycemetery
Hello, everyone.  I would like to save bandwidth.  If an email has a  
large attachment that I know I do not need, is it possible to delete  
the attachment from mutt's index view and *then* open (download) the  
message body?  I found no such command in mutt's documentation.


Thank you.


Re: Making attachments [Was: Re: order of sending mail and saving to fcc

2019-06-16 Thread Kevin J. McCarthy

On Sun, Jun 16, 2019 at 03:34:00PM +1000, Erik Christiansen wrote:

That looks quite useful. There's also the CheckAttach vim plugin, by
Christian Brabandt.


Starting in 1.10, there is also $abort_noattach in Mutt.  It's not quite 
as useful, because it waits until you hit send and then scans the text. 
But it's also configurable via $abort_noattach_regexp.  1.11 "fixed" the 
scanner to not scan quoted text too.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Making attachments [Was: Re: order of sending mail and saving to fcc

2019-06-15 Thread Erik Christiansen
On 16.06.19 09:48, Cameron Simpson wrote:
> I compose with edit_headers=yes, so recipients and subject are part of the
> temporary file.
> 
> Also, I attach using the Attach: pseudo header, so the attachment filename
> is also part of the temp file. Provided I haven't exited the compose mode
> (when the Attach: headers turn into actual mutt attachments) I don't lose
> that state either. (I've also got fcc_attach=yes, might be handy too.)
> 
> And to ease using the Attach: header I have this vi macro:
> 
>  map ^A 1G}-:.r!exec /dev/tty; readline -B 'Attach: '^MIAttach: ^[
> 
> Those are literal ctrl-A, ctrl-M, ctrl-[ (escape) in the macro. This means
> that I just type ctrl-A to commence an attachment and I get a file competion
> capable prompt to fill out the filename.

That looks quite useful. There's also the CheckAttach vim plugin, by
Christian Brabandt. It detects words such as "attached" in the
email body, then prompts on exit to mutt, repeating until no further
attachment paths are provided - thereby doing the remembering too. It
doesn't trigger on quoted text. The set of trigger words is
configurable. It also uses an "Attach:" header.

You'd think that someone who rereads before sending wouldn't forget that
an attachment was intended, but I have found its memory useful on more
than one occasion, especially on longish emails.

Erik


Re: "fast" save of attachments from multiple messages

2018-02-02 Thread Cameron Simpson

On 02Feb2018 04:13, Claus Assmann <mutt+us...@esmtp.org> wrote:

Is there some fast way to save the attachments from multiple messages?
That is, without going to every individual message, viewing and
then saving the attachments? I can tag the attachments in a single
message and save them easily, but seemingly not for multiple messages
(AFAICT). Something like a "save attachments" option (after tagging
the messages) or some "clever" macro?

This would be useful as I sometimes get many messages with one
attachment each instead of one message with many attachments (e.g.,
to avoid messages that are too large for some MTA configurations).


If you have the munpack or metamail commands on your system you can use them to 
unpack messages, extracting the attachments. If you're standing in the 
directory where you want the attachments extracted you could:


 - tag the messages

 - type ";|munpack" or ";|metamail -w -x" to extract the contents

You will need the setting pipe_split=yes to run each message on its own.

Once sorted you'll probably want to make a macro to make this easy after 
tagging the messages. You might also want to have a preferred place to extract 
things.


For example, on a single message basis I've got "V" bound to 
"mail-open-attachments", which I've attached. I'm on a 
Mac, so that makes a scratch directory, unpacks the message with munpack, then 
opens the directory in the Finder for me to fiddle with. Hack to suit.


Cheers,
Cameron Simpson <c...@cskk.id.au> (formerly c...@zip.com.au)
#!/bin/sh
#
# Unpack the MIME message named (or on stdin) in a temp direct and open.
#   - Cameron Simpson <c...@cskk.id.au> 16nov2015
#

set -uex

outdir=$HOME/var/mail-attachments

cmd=$(basename "$0")
unpackdir=$outdir/$(datecode)-$$

mkdir "$unpackdir"
cat ${1+"$@"} | munpack -C "$unpackdir" -t
( cd "$unpackdir"; fixexts * ) || :
open "$unpackdir"


"fast" save of attachments from multiple messages

2018-02-02 Thread Claus Assmann
Is there some fast way to save the attachments from multiple messages?
That is, without going to every individual message, viewing and
then saving the attachments? I can tag the attachments in a single
message and save them easily, but seemingly not for multiple messages
(AFAICT). Something like a "save attachments" option (after tagging
the messages) or some "clever" macro?

This would be useful as I sometimes get many messages with one
attachment each instead of one message with many attachments (e.g.,
to avoid messages that are too large for some MTA configurations).



Re: attachments not shown

2018-02-01 Thread Cameron Simpson

On 01Feb2018 21:54, Will Yardley  wrote:

Also, you can configure the order mutt displays them in, for example, I
have:
alternative_order text/calendar text/plain text/enriched text/html test/*

Sometimes it does screw me up if the text/plain and text/html parts of a
multipart/mixed messages aren't actually equivalent as they're supposed
to, and I end up missing part of an email because Mutt doesn't show it
to me based on my configured order.


Yeah. Fortunately such things are still few enough to track. I've got this in 
my muttrc:


 message-hook '%f htmlers | ~f @no-re...@cc.yahoo-inc.com | ~f @outlook.com | 
~f live.com | ~f @facebookmail.com' 'unalternative_order *; alternative_order 
text/html text/plain'

So that mutt picks the HTML first for people in the "htmlers" group and an 
assortment of other known broken senders. My default is tex/plain first.


Cheers,
Cameron Simpson  (formerly c...@zip.com.au)


Re: attachments not shown

2018-02-01 Thread Will Yardley
On Fri, Feb 02, 2018 at 02:30:16PM +1100, Cameron Simpson wrote:
> On 02Feb2018 10:45, Yubin Ruan <ablacktsh...@gmail.com> wrote:

> > I got three attachments in a mail, as shown in the attachment view:
> > 
> >[multipart/alternative, 7bit, 97K]
> >[text/plain, quoted, utf-8, 9.2K]
> >[text/html, quoted, utf-8, 87K]
> 
> That's really 2 attachments. The text/plain and text/html parts are
> _enclosed by the multipart/alternative part, which exists to offer two or
> more choices which are meant to be equivalent.

Also, you can configure the order mutt displays them in, for example, I
have:
alternative_order text/calendar text/plain text/enriched text/html test/*


Sometimes it does screw me up if the text/plain and text/html parts of a
multipart/mixed messages aren't actually equivalent as they're supposed
to, and I end up missing part of an email because Mutt doesn't show it
to me based on my configured order.

w



Re: attachments not shown

2018-02-01 Thread Yubin Ruan
On Fri, Feb 02, 2018 at 02:30:16PM +1100, Cameron Simpson wrote:
> On 02Feb2018 10:45, Yubin Ruan <ablacktsh...@gmail.com> wrote:
> > Hi,
> > 
> > I got three attachments in a mail, as shown in the attachment view:
> > 
> >[multipart/alternative, 7bit, 97K]
> >[text/plain, quoted, utf-8, 9.2K]
> >[text/html, quoted, utf-8, 87K]
> 
> That's really 2 attachments. The text/plain and text/html parts are
> _enclosed by the multipart/alternative part, which exists to offer two or
> more choices which are meant to be equivalent.
> 
> > After using the editor to view the whole email, it seems to me that the
> > [multipart/alternative] part is an alias for both the [text/plain] and
> > [text/html] part, because from what I have seen, there is no actual content 
> > in
> > the [multipart/alternative] part.
> 
> Yes, it is just an enclosure. In fact it is likely that the message itself
> is the multipart/alternative part, containing a text/plain and a text/html
> within it. But you can nest multipart sections if you need to.
> 
> [...]
> > the problem is, even though there are three attachments, only one is shown. 
> > I
> > already have a
> > 
> >auto_view text/html
> > 
> > set in my .muttrc, yet the [text/html] is not shown (I can view the
> > [text/html] attachment in the attachment view, though ). AFAIK, mutt will 
> > try
> > to display all attachments automatically as long as it can be autoviewed. Is
> > there any configuration options I miss here?
> 
> Ah, no.
> 
> What you've got looks like this, structurally:
> 
>  multipart/alternative
>text/plain
>  some plain text ...
>text/htmnl
>  some HTML text ...
> 
> The main text/ area is the "message" part. When mutt displays a message from
> a multipart/alternative section it chooses _one_ of the alternatives offers,
> and transcribes that to a plain text appearance using the rules from your
> mailcap settings (which may just be the system defaults).
> 
> A message with "attachments" comes with the type "multipart/mixed",
> indicating that it contains a mixture of parts, almost always a "message"
> part with the text and other parts being the zttachments, such as zip files.
> A mail message with attachments usually looks like this, structurally:
> 
>  multipart/mixed
>multipart/alternative
>  text/plain
>some plain text ...
>  text/htmnl
>some HTML text ...
>image/jpeg
>  a JPEG image, suitably encoded
>application/pdf
>  a PDF file
> 
> and so forth.
> 
> So what you have is a plain text message with no "attachments". The mutt
> "attachement" menu shows you all the parts, but more conventional mail
> readers withn't present the text area as an "attachment".
> 
> Regarding your beleif that you're getting the text/plain presented, this may
> well be so. Your setting:
> 
>  auto_view text/html
> 
> is documented here:
> 
>  http://www.mutt.org/doc/manual/#auto-view
> 
> It says that you know how to present text/html as plain text for viewing in
> the "pager" mutt view. It will look up a mailcap entry for "text/plain"
> which has the "copiousoutput" option. If you or your system doesn't have
> such an entry the "auto_view" setting is probably ignored. So mutt may be
> choosing the text/plain alternative because of this.
> 
> There is a system mailcap file and you can also have a personal
> $HOME/.mailcap file. Mine has this:
> 
>  text/html; exec 2>&1 && env DISPLAY= unhtml %s; copiousoutput
> 
> and "unhtml" is a script of mine which currently calls "lynx -stdin -dump",
> and used to run "w3m -dump -T text/html". So you could use:
> 
>  text/html; w3m -dump -T text/html; copiousoutput
> 
> to tell mutt how to present HTML as plain text.
> 
> Mutt needs such things because the pager presents plain text.

Thanks for your explanation about [multipart/alternative] and
[multipart/mixed]. I check several mails and they all seems to work in the way
you described.

--
Yubin


Re: attachments not shown

2018-02-01 Thread Cameron Simpson

On 02Feb2018 10:45, Yubin Ruan <ablacktsh...@gmail.com> wrote:

Hi,

I got three attachments in a mail, as shown in the attachment view:

   [multipart/alternative, 7bit, 97K]
   [text/plain, quoted, utf-8, 9.2K]
   [text/html, quoted, utf-8, 87K]


That's really 2 attachments. The text/plain and text/html parts are _enclosed 
by the multipart/alternative part, which exists to offer two or more choices 
which are meant to be equivalent.



After using the editor to view the whole email, it seems to me that the
[multipart/alternative] part is an alias for both the [text/plain] and
[text/html] part, because from what I have seen, there is no actual content in
the [multipart/alternative] part.


Yes, it is just an enclosure. In fact it is likely that the message itself is 
the multipart/alternative part, containing a text/plain and a text/html within 
it. But you can nest multipart sections if you need to.


[...]

the problem is, even though there are three attachments, only one is shown. I
already have a

   auto_view text/html

set in my .muttrc, yet the [text/html] is not shown (I can view the
[text/html] attachment in the attachment view, though ). AFAIK, mutt will try
to display all attachments automatically as long as it can be autoviewed. Is
there any configuration options I miss here?


Ah, no.

What you've got looks like this, structurally:

 multipart/alternative
   text/plain
 some plain text ...
   text/htmnl
 some HTML text ...

The main text/ area is the "message" part. When mutt displays a message from a 
multipart/alternative section it chooses _one_ of the alternatives offers, and 
transcribes that to a plain text appearance using the rules from your mailcap 
settings (which may just be the system defaults).


A message with "attachments" comes with the type "multipart/mixed", indicating 
that it contains a mixture of parts, almost always a "message" part with the 
text and other parts being the zttachments, such as zip files. A mail message 
with attachments usually looks like this, structurally:


 multipart/mixed
   multipart/alternative
 text/plain
   some plain text ...
 text/htmnl
   some HTML text ...
   image/jpeg
 a JPEG image, suitably encoded
   application/pdf
 a PDF file

and so forth.

So what you have is a plain text message with no "attachments". The mutt 
"attachement" menu shows you all the parts, but more conventional mail readers 
withn't present the text area as an "attachment".


Regarding your beleif that you're getting the text/plain presented, this may 
well be so. Your setting:


 auto_view text/html

is documented here:

 http://www.mutt.org/doc/manual/#auto-view

It says that you know how to present text/html as plain text for viewing in the 
"pager" mutt view. It will look up a mailcap entry for "text/plain" which has 
the "copiousoutput" option. If you or your system doesn't have such an entry 
the "auto_view" setting is probably ignored. So mutt may be choosing the 
text/plain alternative because of this.


There is a system mailcap file and you can also have a personal $HOME/.mailcap 
file. Mine has this:


 text/html; exec 2>&1 && env DISPLAY= unhtml %s; copiousoutput

and "unhtml" is a script of mine which currently calls "lynx -stdin -dump", and 
used to run "w3m -dump -T text/html". So you could use:


 text/html; w3m -dump -T text/html; copiousoutput

to tell mutt how to present HTML as plain text.

Mutt needs such things because the pager presents plain text.

Cheers,
Cameron Simpson <c...@cskk.id.au> (formerly c...@zip.com.au)


attachments not shown

2018-02-01 Thread Yubin Ruan
Hi,

I got three attachments in a mail, as shown in the attachment view:

[multipart/alternative, 7bit, 97K]
[text/plain, quoted, utf-8, 9.2K]
[text/html, quoted, utf-8, 87K]

After using the editor to view the whole email, it seems to me that the
[multipart/alternative] part is an alias for both the [text/plain] and
[text/html] part, because from what I have seen, there is no actual content in
the [multipart/alternative] part. Instead there are just some pointers:

MIME-Version: 1.0
Content-Type: multipart/alternative; 
boundary="=_Part_3237106_526482122.1517522433475"
To: =?UTF-8?B?6Ziu57695b2s?= <ablacktsh...@gmail.com>
Date: Thu, 1 Feb 2018 22:00:33 + (UTC)
X-LinkedIn-Class: CED
X-LinkedIn-Template: email_feed_ecosystem_digest_01
X-LinkedIn-fbl: 
m2-aszwv6yn2cyx11t27w2a5c2iw6ykfaqm3z4r4y5utivh7zm3r8pfdnpmndytd6fy0d1g032mbv6i8vhn8tppibujje9ixay0t8s8xc
X-LinkedIn-Id: 6mvow3-jd475j9d-y4
List-Unsubscribe: 
<https://www.linkedin.com/e/v2?e=6mvow3-jd475j9d-y4=lun=AQFSR-6AohV2qQ=email_feed_ecosystem_digest_01=55=unsub=unsub=AQGfHwfVJDz4lWFTYrQP3DmU3nR4Vc7hiisLwhhS62wLY-Uz96VXZKmDjXHXWjHB9ul6Sf7-NkW9WoU8nPw4_e-Dt8De4ThCER44=6mvow3-jd475j9d-y4>
Feedback-ID: email_feed_ecosystem_digest_01:linkedin
Require-Recipient-Valid-Since: ablacktsh...@gmail.com; Sat, 14 Feb 2015 
07:45:15 +

the [text/plain] part looks like:

--=_Part_3237106_526482122.1517522433475
Content-Type: text/plain;charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-ID: text-body

LinkedIn Highlights

Should I tell coworkers my salary?

264 people are talking about this

https://www.linkedin.com/comm/search/results/content/?keywords=3DShould+I+t=
ell+coworkers+my+salary%3F=3DFED_EMAIL=3D506458=
=3DAQFSR-6AohV2qQ=3Deml-email_feed_ecosystem_digest_01-hero-1-null=
mail=3Deml-email_feed_ecosystem_digest_01-hero-1-null-null-6mvow3%7Ejd475j9=
d%7Ey4-null-neptune%2Fsearch%2Eresults%2Econtent=3Durn%3Ali%3Apage%3Ae=
mail_email_feed_ecosystem_digest_01%3BrxyHuw3NTWi4n8fHNW81ig%3D%3D

 =20

...more content here...

and the [text/html]:

--=_Part_3237106_526482122.1517522433475
Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-ID: html-body

http://www.=
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> http://www.w3=
.org/1999/xhtml" lang=3D"en" xml:lang=3D"en">

Re: Can I have a default save folder for attachments?

2018-01-19 Thread Jason
On Fri, Jan 19, 2018 at 04:33:39PM +0100, Francesco Ariis wrote:
> On Thu, Jan 18, 2018 at 09:43:11PM -0600, Jason wrote:
> > When I press 's' on an attachment to save it, it wants to save it in
> > the home directory. Is it possible to have a default attachments
> > folder set up that attachments automatically get saved to or at least have
> > the suggested file name prefixed with the
> > /path/to/attachments/directory/ ?
> 
> Hello Jason,
> see if
> 
> macro attach S ~/downloads/
> 
> is what you like
> -F
Perfect! Just what I wanted.

Thanks, Francesco.

-- 
Jason



Re: Can I have a default save folder for attachments?

2018-01-19 Thread Francesco Ariis
On Thu, Jan 18, 2018 at 09:43:11PM -0600, Jason wrote:
> When I press 's' on an attachment to save it, it wants to save it in
> the home directory. Is it possible to have a default attachments
> folder set up that attachments automatically get saved to or at least have
> the suggested file name prefixed with the
> /path/to/attachments/directory/ ?

Hello Jason,
see if

macro attach S ~/downloads/

is what you like
-F



Can I have a default save folder for attachments?

2018-01-18 Thread Jason
Hello,

When I press 's' on an attachment to save it, it wants to save it in
the home directory. Is it possible to have a default attachments
folder set up that attachments automatically get saved to or at least have
the suggested file name prefixed with the
/path/to/attachments/directory/ ?

Thanks!
-- 
Jason



Re: After change-folder listing the attachments folder does not work

2017-09-01 Thread Kevin J. McCarthy
On Fri, Sep 01, 2017 at 07:51:54AM +0200, Kai Weber wrote:
> BTW, with either NeoMutt or Mutt 1.8.3 I get
> 
>Error in /home/kai/.config/mutt/muttrc, line 13: header_cache:unknown
> variable
>source: errors in  /home/kai/.config/mutt/muttrc

By default, Mutt has a minimal configuration.  I would recommend first
running:
  apt-get build-dep mutt

How you configure is a personal opinion, but here are some options you
may want to pass to configure:

./configure \
--prefix=/usr/local \
--with-mailpath=/var/mail   \
--enable-debug  \
--enable-fcntl  \
--enable-hcache \
--enable-gpgme  \
--enable-imap   \
--enable-smtp   \
--enable-pop\
--enable-sidebar\
--enable-compressed \
--with-curses   \
--with-gnutls   \
--with-gss  \
--with-idn  \
--with-mixmaster\
--with-sasl \
--without-gdbm  \
--without-bdb   \
--without-qdbm

I like the newer kyotocabinet header cache, so I also would install the
libkyotocabinet-dev package and add to configure:
   --without-tokyocabinet \
   --with-kyotocabinet

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kai Weber

On 08-31-17, Kevin J. McCarthy wrote:

Mutt 1.8.3 tarball works.
NeoMutt Github master works
Debian NeoMutt/Mutt package NeoMutt 20170609 (1.8.3) does not work

So, I have to file a bug against the Debian package?


It sounds like a good idea.

However, there is currently a freeze in the Debian mutt package, until
Debian bug #870635 is resolved.  You may want to wait until their next
upload and see what happens.


I see. I wait until the the bug is resolved and use Mutt from the 
tarball.


BTW, with either NeoMutt or Mutt 1.8.3 I get

   Error in /home/kai/.config/mutt/muttrc, line 13: header_cache: 
   unknown variable

   source: errors in  /home/kai/.config/mutt/muttrc

Seems I have to report another bug...

Thanks for the help


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 11:31:13PM +0200, Kai Weber wrote:
> On 08-31-17, Kevin J. McCarthy wrote:
> 
> > In an off-list reply, Kai mentioned he's running the Debian neomutt
> > package.
> 
> Which was a mistake...

Yes, sorry I meant that as an explanation of why I was asking you to try
the mutt-1.8.3 tarball, not as an accusation.

> > Kai, would you be willing to try compiling the mutt-1.8.3 tarball or
> > mercurial tip and see if the bug is present there?
> 
> Mutt 1.8.3 tarball works.
> NeoMutt Github master works
> Debian NeoMutt/Mutt package NeoMutt 20170609 (1.8.3) does not work
> 
> So, I have to file a bug against the Debian package?

It sounds like a good idea.

However, there is currently a freeze in the Debian mutt package, until
Debian bug #870635 is resolved.  You may want to wait until their next
upload and see what happens.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Ian Zimmerman
On 2017-08-31 23:31, Kai Weber wrote:

> Mutt 1.8.3 tarball works.
> NeoMutt Github master works
> Debian NeoMutt/Mutt package NeoMutt 20170609 (1.8.3) does not work

This looks like some fix from mutt (the real thing) that has recently
been merged into neomutt, but only after debian froze their package.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kai Weber

On 08-31-17, Kevin J. McCarthy wrote:


In an off-list reply, Kai mentioned he's running the Debian neomutt
package.


Which was a mistake...


Kai, would you be willing to try compiling the mutt-1.8.3 tarball or
mercurial tip and see if the bug is present there?


Mutt 1.8.3 tarball works.
NeoMutt Github master works
Debian NeoMutt/Mutt package NeoMutt 20170609 (1.8.3) does not work

So, I have to file a bug against the Debian package?


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kai Weber

On 08-31-17, Kevin J. McCarthy wrote:


Browsing folders using '?' does change some state: it records the most
recent directory so the next browsing starts in the same place.  Just
entering the folder name and hitting enter doesn't do that.

I'll have to dig in a bit to see the problem, but some repeatable
instructions would help.  Does this happen if you start mutt, hit ",i",
and then compose a message.


It has the same effect.

  =personal: No such file or directory (errno = 2)

I grepped a little bit through the manual. Maybe I have to use  or
a combination of  and ?

And, as I just found out, Debian ships NeoMutt. I hope this is not a problem.

  Kai




Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 10:34:26PM +0200, Kai Weber wrote:
> On 08-31-17, Ian Zimmerman wrote:
> 
> > I strongly suspect this is related to the following discussion:
> > 
> > https://github.com/neomutt/neomutt/issues/609
> > 
> > You could try neomutt, where my proposed patch has been integrated.
> 
> I just build the Github master and it works.

In an off-list reply, Kai mentioned he's running the Debian neomutt
package.

Kai, would you be willing to try compiling the mutt-1.8.3 tarball or
mercurial tip and see if the bug is present there?

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kai Weber

On 08-31-17, Ian Zimmerman wrote:


I strongly suspect this is related to the following discussion:

https://github.com/neomutt/neomutt/issues/609

You could try neomutt, where my proposed patch has been integrated.


I just build the Github master and it works.


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 01:18:40PM -0700, Ian Zimmerman wrote:
> On 2017-08-31 12:49, Kevin J. McCarthy wrote:
> 
> > I understand it was probably easy to forget, while in the midst of
> > dissing the "ultra-conservative" mutt devs and community, that I fixed
> > your patch and at least gave it serious consideration.
> 
> The real reason it was easy to forget was the time that had passed.  But
> you're right, I should have attributed you despite that.  I'm flawed
> like everyone.

Okay, fair enough.  I admit I'm being a bit of an ass.  For that I also
apologize.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Ian Zimmerman
On 2017-08-31 12:49, Kevin J. McCarthy wrote:

> I understand it was probably easy to forget, while in the midst of
> dissing the "ultra-conservative" mutt devs and community, that I fixed
> your patch and at least gave it serious consideration.

The real reason it was easy to forget was the time that had passed.  But
you're right, I should have attributed you despite that.  I'm flawed
like everyone.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 12:07:41PM -0700, Ian Zimmerman wrote:
> On 2017-08-31 10:56, Kevin J. McCarthy wrote:
> 
> > > I strongly suspect this is related to the following discussion:
> > > 
> > > https://github.com/neomutt/neomutt/issues/609
> > 
> > Look like "your" patch contained my fixes, posted in
> > <20150608225607.gd8...@zaogao.lan> on mutt-dev.  Thanks for the (lack
> > of) attribution.  Very classy.
> 
> I apologize.
> 
> Let's change it to "my proposal".  That OK with you?

I don't really care what you call it on this mailing list; the
attribution was deserved in the commit.

I understand it was probably easy to forget, while in the midst of
dissing the "ultra-conservative" mutt devs and community, that I fixed
your patch and at least gave it serious consideration.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Ian Zimmerman
On 2017-08-31 10:56, Kevin J. McCarthy wrote:

> > I strongly suspect this is related to the following discussion:
> > 
> > https://github.com/neomutt/neomutt/issues/609
> 
> Look like "your" patch contained my fixes, posted in
> <20150608225607.gd8...@zaogao.lan> on mutt-dev.  Thanks for the (lack
> of) attribution.  Very classy.

I apologize.

Let's change it to "my proposal".  That OK with you?

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 09:07:08AM -0700, Ian Zimmerman wrote:
> On 2017-08-31 09:16, Kai Weber wrote:
> 
> > I have a quite common multi account setup with multiple folders for my
> > account. I use folder-hooks to switch various settings based on the
> > folder I change into.
> > 
> > I have some macros to go directly to one folder:
> > 
> >macro index ,i "=personal/INBOX"
> > 
> > If I use this macro to go to a folder, when composing a mail adding
> > attachments does not work as expected:
> 
> I strongly suspect this is related to the following discussion:
> 
> https://github.com/neomutt/neomutt/issues/609

Look like "your" patch contained my fixes, posted in
<20150608225607.gd8...@zaogao.lan> on mutt-dev.  Thanks for the (lack
of) attribution.  Very classy.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Kevin J. McCarthy
On Thu, Aug 31, 2017 at 09:16:46AM +0200, Kai Weber wrote:
> I have a quite common multi account setup with multiple folders for my
> account. I use folder-hooks to switch various settings based on the folder I
> change into.
> 
> I have some macros to go directly to one folder:
> 
>macro index ,i "=personal/INBOX"
> 
> If I use this macro to go to a folder, when composing a mail adding
> attachments does not work as expected:
> 
> 1. Use the macro to go into a folder
> 2. Start composing a mail
> 3. try to add attachments by pressing "a"
> 4. If it says Attach file ('?' for list): press "?"
> 5. Error message is: No such file or directory =personal
> 
> It seems,  does also change to the directory =personal while
> switching folders by browsing through the mailbox list does not change the
> directory and stays in my $HOME directory.

Browsing folders using '?' does change some state: it records the most
recent directory so the next browsing starts in the same place.  Just
entering the folder name and hitting enter doesn't do that.

I'll have to dig in a bit to see the problem, but some repeatable
instructions would help.  Does this happen if you start mutt, hit ",i",
and then compose a message.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: After change-folder listing the attachments folder does not work

2017-08-31 Thread Ian Zimmerman
On 2017-08-31 09:16, Kai Weber wrote:

> I have a quite common multi account setup with multiple folders for my
> account. I use folder-hooks to switch various settings based on the
> folder I change into.
> 
> I have some macros to go directly to one folder:
> 
>macro index ,i "=personal/INBOX"
> 
> If I use this macro to go to a folder, when composing a mail adding
> attachments does not work as expected:

I strongly suspect this is related to the following discussion:

https://github.com/neomutt/neomutt/issues/609

You could try neomutt, where my proposed patch has been integrated.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.


After change-folder listing the attachments folder does not work

2017-08-31 Thread Kai Weber

Hello,

I have a quite common multi account setup with multiple folders for my 
account. I use folder-hooks to switch various settings based on the 
folder I change into.


I have some macros to go directly to one folder:

   macro index ,i "=personal/INBOX"

If I use this macro to go to a folder, when composing a mail adding 
attachments does not work as expected:


1. Use the macro to go into a folder
2. Start composing a mail
3. try to add attachments by pressing "a"
4. If it says Attach file ('?' for list): press "?"
5. Error message is: No such file or directory =personal

It seems,  does also change to the directory =personal 
while switching folders by browsing through the mailbox list does not 
change the directory and stays in my $HOME directory.


Do you experience the same problem?

You can have a look at my config on github 
https://github.com/kwbr/config-mail/tree/master/.mutt





selecting target folder for multiple tagged attachments

2017-03-09 Thread Peter P.
Hi list,

the following task in mutt does always puzzle me:

I am tagging multiple attachements in an email message and want to save
them into a folder onto my disk. I execute
; s
so save all tagged attachment. Mutt asks me "Save to file:"
and I start entering the path, folder by folder, using TAB to
autocomplete a folder's name. Once I have traversed the folder structure
deep enought to not remember names any more I press TAG again to have
mutt display me all folders within the current one. Using the up/down
arrow keys and the Enter key I navigate into the target folder. The
actual riddle is: One I am within that target folder, I can't find a way
to let mutt know that I have arrived. I can, upon pressing Enter either
select a file within that folder (which would get overridden by the
attachment(s) I want to save) or leave that folder for its containing
parent-folder.

Am I missing something obvious? Also I noticed a =:Goto shortcut being
displayed in the info line at the bottom, but this takes me somewhere
els (where?).

Thank you for your ideas!
P


Re: Forwarding attachments isn't working for some reason

2017-02-04 Thread Christian Ebert
* Chris Green on Saturday, February 04, 2017 at 15:37:09 +
> When I forward an E-Mail with attachments (e.g. one with some
> pictures) the result is broken somehow.  In the forwarded message the
> attachments are simply seen as part of the message rather than
> attachments.
> 
> Is there something wrong with my mutt configration, or do I need to do
> something different when forwarding attachments, or what?

What is your setting of mime_forward ?

I've set it to ask-no

-- 
theatre - books - texts - movies
Black Trash Productions at home: https://blacktrash.org
Black Trash Productions on Facebook:
https://www.facebook.com/blacktrashproductions


Re: Forwarding attachments isn't working for some reason

2017-02-04 Thread Chris Green
On Sat, Feb 04, 2017 at 03:37:09PM +, Chris Green wrote:
> When I forward an E-Mail with attachments (e.g. one with some
> pictures) the result is broken somehow.  In the forwarded message the
> attachments are simply seen as part of the message rather than
> attachments.
> 
> Is there something wrong with my mutt configration, or do I need to do
> something different when forwarding attachments, or what?
> 
Sorry, I should have looked harder in mutt.org first, I found the
answer:-

set mime_forward=yes set mime_forward_rest=yes

... sorry for the noise.


-- 
Chris Green


Re: Forwarding attachments isn't working for some reason

2017-02-04 Thread Matthias Apitz

On Saturday, 4 February 2017 16:37:09 CET, Chris Green <c...@isbd.net> wrote:

When I forward an E-Mail with attachments (e.g. one with some
pictures) the result is broken somehow.  In the forwarded message the
attachments are simply seen as part of the message rather than
attachments.

Is there something wrong with my mutt configration, or do I need to do
something different when forwarding attachments, or what?



I do:

v  to view all attachments, parts
t  tag all attachments, parts to be fwd'ed
;  to say 'do the next command on all tagged'
f  cmd is forward

now mutt asks for To, ...

HIH

matthias



--
Sent from my Ubuntu phone
http://www.unixarea.de/


Forwarding attachments isn't working for some reason

2017-02-04 Thread Chris Green
When I forward an E-Mail with attachments (e.g. one with some
pictures) the result is broken somehow.  In the forwarded message the
attachments are simply seen as part of the message rather than
attachments.

Is there something wrong with my mutt configration, or do I need to do
something different when forwarding attachments, or what?

-- 
Chris Green


Re: message-ids containing slashes was: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-11-19 Thread David Champion
* On 19 Nov 2016, Cameron Simpson wrote: 
> Just to followup on this, here I am code reviewing some stuff for work and
> what does github use for Message-IDs? This:
> 
>  Message-ID: 

Interesting. I guess I would be inclined to solve this by simply
urllib.quote()ing the string - consistent and predictable encoding no
matter what oddities appear in the original string.

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


signature.asc
Description: PGP signature


message-ids containing slashes was: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-11-19 Thread Cameron Simpson

On 15Sep2016 11:52, Cameron Simpson  wrote:

On 14Sep2016 18:35, David Champion  wrote:

It will create a directory under /tmp/foo named for the message's
message-id, and store each attachment inside. Filenames are taken
from the MIME or generated sequentially if there is no filename.


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.


Just to followup on this, here I am code reviewing some stuff for work and what 
does github use for Message-IDs? This:


 Message-ID: 

So there we have it, slashes in message-ids in the wild. I'm not objecting - it 
is perfectly legal and reasonable and very readable. Just an inconvenient 
datum.


Cheers,
Cameron Simpson 


Re: Forwarded attachments catenation

2016-11-10 Thread Bob Proulx
Mihail Konev wrote:
> When forwarding a message, mutt catenates all the attachments into the
> body.
> 
> Is this a correct behaviour?
> How to avoid it?

The behavior is controlled by the mime_forward variable.  The default
value is the traditional way mailers have always handled mail.  It may
optionally select mime attachments.

Here is the section of the mutt manual that describes it.

   7. Forwarding and Bouncing Mail
   ...
   Forwarding can be done by including the original message in the new
   message's body (surrounded by indicating lines) or including it as a
   MIME attachment, depending on the value of the $mime_forward
   variable. Decoding of attachments, like in the pager, can be controlled
   by the $forward_decode and $mime_forward_decode variables,
   respectively. The desired forwarding format may depend on the content,
   therefore $mime_forward is a quadoption which, for example, can be
   set to "ask-no".

   The inclusion of headers is controlled by the current setting of the
   $weed variable, unless $mime_forward is set.
   ...


Re: Forwarded attachments catenation

2016-11-10 Thread Mihail Konev
On Thu, Nov 10, 2016 at 03:22:03PM -0700, Bob Proulx wrote:
> The behavior is controlled by the mime_forward variable.  The default
> value is the traditional way mailers have always handled mail.  It may
> optionally select mime attachments.
> 
> Here is the section of the mutt manual that describes it.
> 
Sorry, didn't rtfm in panic :)


Forwarded attachments catenation

2016-11-10 Thread Mihail Konev
When forwarding a message, mutt catenates all the attachments into the
body.

Is this a correct behaviour?
How to avoid it?


Re: How to save multiple attachments quickly

2016-11-06 Thread Chris Green
On Sat, Nov 05, 2016 at 09:09:25PM +0500, Konstantin Ovsov wrote:
> Hi,
> 
> i use a script (see attachment). Also required ripmime 
> (https://github.com/inflex/ripMIME).
> The index-mode on the message press the F2-button and all attachments are 
> stored in a folder with name of subject the message. 
> 
Now that seems a good idea, thanks.

-- 
Chris Green


Re: How to save multiple attachments quickly

2016-11-05 Thread Konstantin Ovsov
Hi,

i use a script (see attachment). Also required ripmime 
(https://github.com/inflex/ripMIME).
The index-mode on the message press the F2-button and all attachments are 
stored in a folder with name of subject the message.

The settings assigned to key: 
macro index"~/.mutt/rip_ma.sh" "Save all
attacments"

On пт, 04 ноя 2016, 13:04, Chris Green wrote:
> I have just sent myself an E-Mail which has 50 or so attachments, they
> are a load of VCARD files which I can't concatenate at the sending
> end. 
> 
> So, how can I save them all quickly without doing each one separately?
> 
> -- 
> Chris Green

-- 
Konstantin


rip_ma.sh
Description: Bourne shell script


Re: How to save multiple attachments quickly

2016-11-05 Thread Matthias Apitz
El día Saturday, November 05, 2016 a las 09:07:02AM +, Chris Green escribió:

> If I understand you right that's at the sending end, no good at all,

Oh, sorry. You are right, it's the sending end. I have miss-read your
mail.

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, ⌂ http://www.unixarea.de/  ☎ 
+49-176-38902045


Re: How to save multiple attachments quickly

2016-11-05 Thread Chris Green
On Fri, Nov 04, 2016 at 03:18:31PM +0100, Matthias Apitz wrote:
> El día Friday, November 04, 2016 a las 01:04:17PM +, Chris Green escribió:
> 
> > I have just sent myself an E-Mail which has 50 or so attachments, they
> > are a load of VCARD files which I can't concatenate at the sending
> > end. 
> > 
> > So, how can I save them all quickly without doing each one separately?
> 
> This depends highly of your environment and esp. the editor your are
> using. I use 'vim' and this has some addon:
> 
> $ find ~/.vim | fgrep Che
> /home/guru/.vim/ftplugin/mail/CheckAttach.vim
> /home/guru/.vim/doc/CheckAttach.txt
> 
> which will ask for the files to be attached when you leave vim and the
> text contains certain words, like 'attach'; in this case, before ending
> the vim session, it ask for the names and put these name as lines like
> 
> Attach: /home/guru/.vim/doc/CheckAttach.txt
> 
> into the header section of the mail vim is putting together; all these
> files it will, after leaving the edit mode, as attachment into mutt.
> Of course you can somehow put there, for example reading the list from
> some file or 'ls -C1' output like:
> 
> Attach: f1
> Attach: f2
> Attach: f3

If I understand you right that's at the sending end, no good at all,
it's Outlook Web Access.

-- 
Chris Green


Re: How to save multiple attachments quickly

2016-11-05 Thread Chris Green
On Fri, Nov 04, 2016 at 05:15:21PM -0400, Jon LaBadie wrote:
> On Fri, Nov 04, 2016 at 01:04:17PM +, Chris Green wrote:
> > I have just sent myself an E-Mail which has 50 or so attachments, they
> > are a load of VCARD files which I can't concatenate at the sending
> > end. 
> > 
> > So, how can I save them all quickly without doing each one separately?
> > 
> 
> This is still separate, but saves some typing.
> 
> Read the mail message in an empty directory.
> Use the v command to list the separate parts.
> Skipping the body, use the t command to tag each vcard.
>   This isn't too bad as the command tags and moves to the
>   next part, so just hold down for auto repeat
> Use the ";" command to do something with the tagged parts.
>   I didn't find a way to save all in one file,
>   maybe someone else can.
> Use the s command to save the parts.  It will save them
>   one at a time under the original names.  But again,
>   it automatically moves to next item.  Use the auto-
>   repeat feature again with the return key
> 
> Now they are on your linux system and you can catenate
> them easily.
> 
Yes, this is the way I had already discovered and I was hoping to find
something better.

-- 
Chris Green


Re: How to save multiple attachments quickly

2016-11-04 Thread Jon LaBadie
On Fri, Nov 04, 2016 at 01:04:17PM +, Chris Green wrote:
> I have just sent myself an E-Mail which has 50 or so attachments, they
> are a load of VCARD files which I can't concatenate at the sending
> end. 
> 
> So, how can I save them all quickly without doing each one separately?
> 

This is still separate, but saves some typing.

Read the mail message in an empty directory.
Use the v command to list the separate parts.
Skipping the body, use the t command to tag each vcard.
  This isn't too bad as the command tags and moves to the
  next part, so just hold down for auto repeat
Use the ";" command to do something with the tagged parts.
  I didn't find a way to save all in one file,
  maybe someone else can.
Use the s command to save the parts.  It will save them
  one at a time under the original names.  But again,
  it automatically moves to next item.  Use the auto-
  repeat feature again with the return key

Now they are on your linux system and you can catenate
them easily.

jl
-- 
Jon H. LaBadie j...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


Re: How to save multiple attachments quickly

2016-11-04 Thread Matthias Apitz
El día Friday, November 04, 2016 a las 01:04:17PM +, Chris Green escribió:

> I have just sent myself an E-Mail which has 50 or so attachments, they
> are a load of VCARD files which I can't concatenate at the sending
> end. 
> 
> So, how can I save them all quickly without doing each one separately?

This depends highly of your environment and esp. the editor your are
using. I use 'vim' and this has some addon:

$ find ~/.vim | fgrep Che
/home/guru/.vim/ftplugin/mail/CheckAttach.vim
/home/guru/.vim/doc/CheckAttach.txt

which will ask for the files to be attached when you leave vim and the
text contains certain words, like 'attach'; in this case, before ending
the vim session, it ask for the names and put these name as lines like

Attach: /home/guru/.vim/doc/CheckAttach.txt

into the header section of the mail vim is putting together; all these
files it will, after leaving the edit mode, as attachment into mutt.
Of course you can somehow put there, for example reading the list from
some file or 'ls -C1' output like:

Attach: f1
Attach: f2
Attach: f3
...

 
HIH

matthias

-- 
Matthias Apitz, ✉ g...@unixarea.de, ⌂ http://www.unixarea.de/  ☎ 
+49-176-38902045
1990, when the Russians stood in Germany at river Elbe, we have had peace. 
Today the
NATO stands in the Baltic States, in Poland ..., and we have war all over the 
world.
1990, cuando los Rusos estaban en Alemania al río Elba, había paz. Hoy la OTAN 
está
en los países bálticos, en Polonia, ..., y tenemos guerra por todo el mundo.


How to save multiple attachments quickly

2016-11-04 Thread Chris Green
I have just sent myself an E-Mail which has 50 or so attachments, they
are a load of VCARD files which I can't concatenate at the sending
end. 

So, how can I save them all quickly without doing each one separately?

-- 
Chris Green


Re: attachments name non english symbol

2016-09-29 Thread Ionel Mugurel Ciobîcă
On 30-09-2016, at 00h 28'03", Konstantin Ovsov wrote about "Re: attachments 
name non english symbol"
> On Thu, 29 Sep 2016, 10:44:19, Ionel Mugurel Ciobîcă wrote:
> > 
> > Do you forward only the attachments? How do you do that?
> 
> Yes, only forwarded attachments. I press 'v' (view-attachments), select the 
> attachment, press 'f' and send a mail.

Interesting, Konstantin. I did not know that :-)

> But the other reason. If the filename of the attachment is not 
> POSIX-compatible, Mutt substitutes for all not POSIX-symbols on '_'.

I can confirm that. I created a file with the name "з" (Russian zet)
and I send it myself. In the email, I selected the attachment and
press f to forward the attachment. The attachment name was changed to
__. I did the same with a filename called ' ' (just a space). The
filename was changed into _. I repeated the process with a filename
măr (apple in Romanian). The filename was changed into m__r. Annoying,
indeed...

> Thank you again, Ionel.
> 

What I can tell you is that 
1. mutt_sanitize_filename is not UTF-8 aware (otherwise з would be
replaced with one _ and not two. 
2. I do not think you can disable the usage of mutt_sanitize_filename
from mutt variables. You will need to alter the code and re-compile.
Searching with google mutt_sanitize_filename will give some ideas.
If you create a patch you can reuse it everytime you wish to install a
new version of mutt.
3. A work-around: create a copy of the message. Delete the unwanted
attachments. Forward the entire message with F. The filename will keep.


Good luck.

Ionel




Re: attachments name non english symbol

2016-09-29 Thread Konstantin Ovsov
On Thu, 29 Sep 2016, 10:44:19, Ionel Mugurel Ciobîcă wrote:
> On 28-09-2016, at 10h 09'53", Konstantin Ovsov wrote about "[SPAM?] 
> attachments name non english symbol"
> > Hi!
> > 
> > I forward attachments with the russian name. The recipient receives an 
> > email with an attachment with the wrong name. For example, "шрифт.zip" 
> > converted into "__.zip"
> > 
> > It is possible to keep the original name?
> > 
> > If i send a new message, the attachment retains the original name.
> > 
> > mutt version: 1.5.23, 1.6.0, 1.7.0
> > Sorry for my bad English.
> > 
> > -- 
> > Konstantin
> 
> 
> Do you forward only the attachments? How do you do that?

Yes, only forwarded attachments. I press 'v' (view-attachments), select the 
attachment, press 'f' and send a mail.
> 
> You can forward the entire e-mail (including attachments) as attachment with 
> F (not f) if you add this lines in your .muttrc:
> 
> # Forward messages as attachment with F.
> macro index f ":set mime_forward=no\n"
> macro pager f ":set mime_forward=no\n"
> macro index F ":set mime_forward=yes\n:set 
> mime_forward_decode=no\n"
> macro pager F ":set mime_forward=yes\n:set 
> mime_forward_decode=no\n"
> 
> In this care the original message remains unaltered.
> 
> If you use f to forward message, you need to re-actach the attachments 
> yourself. What is the setting of the variable mime_forward?

Thanks for the advice. How to use mime_forward/mime_forward_decode me 
understand.
But the other reason. If the filename of the attachment is not 
POSIX-compatible, Mutt substitutes for all not POSIX-symbols on '_'.

mutt-1.7.0/lib.c

static const char safe_chars[] = 
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+@{}._-:%/";

void mutt_sanitize_filename (char *f, short slash)
{
  if (!f) return;

  for (; *f; f++)
  {
if ((slash && *f == '/') || !strchr (safe_chars, *f))
  *f = '_';
  }
}


Thank you again, Ionel.

> Kind regards,
>  Ionel
> 

-- 
Konstantin



[SPAM?] attachments name non english symbol

2016-09-27 Thread Konstantin Ovsov
Hi!

I forward attachments with the russian name. The recipient receives an email 
with an attachment with the wrong name. For example, "шрифт.zip" converted into 
"__.zip"

It is possible to keep the original name?

If i send a new message, the attachment retains the original name.

mutt version: 1.5.23, 1.6.0, 1.7.0
Sorry for my bad English.

-- 
Konstantin


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

2016-09-16 Thread Luis Mochan
On Fri, Sep 16, 2016 at 11:45:44AM -0300, Marcelo Laia wrote:
> On 15/09/16 at 08:10am, Luis Mochan wrote:
> ...
> When I press 
> 
> Shift+y followed by s in index mode view, current body message is saved inside
> $HOME/attachments/ as textfile0 name.
Yes. The text parts of the message are saved as texfile0, textfile1,...
The named attachments, if present, are saved using their names.
> 
> The next commands is one line or they are 3 lines?
> 
> set - ~/attachments/*
> [ "$*" != "$HOME/attachments/*" ] && rm ~/attachments/*
> ripmime -i - -d ~/attachments
> 
They are three lines.
> Thankx
Regards,
Luis

-- 

  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: Re: Can I use Mutt from Bash to extract attachments into an arbitrary directory?

2016-09-16 Thread Marcelo Laia
On 15/09/16 at 08:10am, Luis Mochan wrote:
> 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!
(...)
> or by adding it to you ~/.mutt/muttrc file so that it is loaded

Yes! I do it! Please, here is what I see when a hint ? in index mode view:

X macro ripmime --paranoid -i - -d
Ys M | ~/.mutt/saveattachm... Save attachments
a create-alias cria um apelido a partir do remetente de uma mensagem
(...)
r reply responde a uma mensagem
s save-message save message/attachment to a mailbox/file
u undelete-message restaura a entrada atual

When I press 

Shift+y followed by s in index mode view, current body message is saved inside
$HOME/attachments/ as textfile0 name.

The next commands is one line or they are 3 lines?

set - ~/attachments/*
[ "$*" != "$HOME/attachments/*" ] && rm ~/attachments/*
ripmime -i - -d ~/attachments


Thankx

-- 
Marcelo


[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 <areemt...@gmail.com> 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 <areemt...@gmail.com> 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


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

2016-09-14 Thread David Champion
* On 14 Sep 2016, Cameron Simpson wrote: 
> 
> Mutt is probably a poor match for the task because although it will decode
> messages etc, all the saving is interactive. In particular, there's no API
> for "iterating" over attachments, let along recursively.

Agree. It's entirely doable, but not worth the trouble and the
maintenance when there are other fine options.

> I'd be going for the Python stuff, lacking your context.

See attached.

You can pipe a message into this program (within mutt or elsewhere):

| mutt-savefiles /tmp/foo

It will create a directory under /tmp/foo named for the message's
message-id, and store each attachment inside. Filenames are taken
from the MIME or generated sequentially if there is no filename.

-- 
David Champion • d...@bikeshed.us
#!/usr/bin/env python
#
# TODO: merge into sympafile
#

import os
import sys
import email
import mimetypes

m = email.message_from_file(sys.stdin)

# mimetypes very unfortunately maps text/plain to .ksh, so
# we'll favor this internal list in type lookups.
localtypes = {
'text/plain': '.txt',
}

if 'message-id' in m:
msgid = m['message-id'].strip('<>')
else:
msgid = str(time.time()).replace('.', '_')

if len(sys.argv) > 1:
dirname = sys.argv[1]
else:
dirname = '.'

dirname = os.path.join(dirname, msgid)
try:
os.makedirs(dirname)
except:
pass

n = 0
for p in m.walk():
n += 1
mtype = p.get_content_type()
if mtype.startswith('multipart/'):
# container
continue

ext = localtypes.get(mtype.lower()) or \
  mimetypes.guess_extension(mtype) or \
  '.bin'
filename = p.get_filename() or ('%02d%s' % (n, ext))
filename = os.path.join(dirname, filename)
data = p.get_payload()
print filename, len(data)
fp = open(filename, 'w')
fp.write(data)
fp.close()


signature.asc
Description: PGP signature


  1   2   3   4   5   6   7   8   9   10   >