Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't stop downloading of emails with huge attachments #2004

Open
axelsimon opened this issue Nov 28, 2019 · 10 comments
Open

Can't stop downloading of emails with huge attachments #2004

axelsimon opened this issue Nov 28, 2019 · 10 comments

Comments

@axelsimon
Copy link

Hi there,
I started an email from my phone (K9, Android) and attached lots of pictures. I didn't realise how large each one was, and i ended up with 179 MB email.

When I went to neomutt to open the draft, it started downloading the whole email, 179 MB of it, without either offering me the option to just download the text part of the email, and not the pictures, or to cancel the download.

So no I'm wastefully downloading 179 MB of data, which could even more of a problem if i was on a metered connection or on a slow downlink.

Expected Behaviour

Neomutt should offer:

  • to chose whether to download attachments or not
  • the option to cancel the download of the email
  • both

NeoMutt Version

NeoMutt 20191102
System: Linux 5.3.8-200.fc30.x86_64 (x86_64)
ncurses: ncurses 6.1.20180923 (compiled with 6.1.20180923)
libidn: 1.35 (compiled with 1.35)
GPGme: 1.12.0
hcache backends: tokyocabinet, lmdb

Extra Info

  • Operating System and its version
    Fedora 30
  • Were you using multiple copies of NeoMutt at once?
    no
  • Were you using 'screen' or 'tmux'?
    yes, tmux
  • Is your email local (maildir) or remote (IMAP)?
    remote: IMAP
@gahr
Copy link
Member

gahr commented Nov 29, 2019

While it is easy to handle a Ctrl-C in the middle of the download of a BODY or RFC822 part, I can't think of how we could recover from such an interruption, short of closing the mailbox: the IMAP server is sending data and is expecting us to handle the data.

Perhaps what we could do is add a configuration parameter to specify the maximum size of a part that we're willing to download automatically. Above this limit, we get a prompt so we can decide to fetch or skip the part. How does that sound? #788 is tangentially related.

@flatcap
Copy link
Member

flatcap commented Nov 29, 2019

Hmm... a quick glance through the FETCH command of RFC3501 shows a possible solution
(I don't know how much work it would be to implement).

FETCH BODY[] can take a <partial> -- a range to download, e.g. 1KiB chunks:

  • FETCH BODY[]<0.1024>
  • FETCH BODY[]<1025.2048>
  • ...

@scottkosty
Copy link
Member

A related topic is that some users (myself included) would like a way to disable downloading of attachments when viewing emails, until actually trying to view the attachments. I don't think this is currently possible with NeoMutt. Here are a couple of references:

https://mutt-users.mutt.narkive.com/tHxtS1zZ/how-to-configure-mutt-to-ask-before-downloading-attachments
https://www.reddit.com/r/commandline/comments/1do23q/how_to_stop_mutt_downloading_attachment_before/c9s6c74/

@flatcap
Copy link
Member

flatcap commented Dec 5, 2019

To get there, we need to support IMAP's BODYSTRUCTURE command.
This is a mostly-working piece of code.

It will tell us the layout of the email and allow us to make decisions, such as:

  • Don't download certain attachment types
  • Always download Signature attachments
  • Don't download attachments larger than X KiB

Here's the BODYSTRUCTURE for an Email with some text and a large pdf attachment:

(
  (
    "TEXT" "PLAIN"
    (
      "CHARSET" "US-ASCII"
    )
    NIL NIL "7BIT" 1152 23
  )
  (
    "TEXT" "PLAIN"
    (
      "CHARSET" "US-ASCII"
      "NAME" "big.pdf"
    )
    "<382374823694.234432@example.com>" "Work Presentation" "BASE64" 45324 73
  )
  "MIXED"
)

@komond
Copy link

komond commented Dec 4, 2020

Why does neomutt download attachments once when we open the email by hitting Enter on the message header, then download them all over again when we view the attachments or reply to the email?

@komond
Copy link

komond commented Dec 5, 2020 via email

@ghost
Copy link

ghost commented Feb 28, 2021

@komond For me attachments were downloaded THREE times! Something is really broken out there. However in Mutt (with the very same configuration) everything works fine: attachments were downloaded once.

neomutt version: NeoMutt 20210205
mutt version: Mutt 2.0.5 (da5e3282) (2021-01-21)
os: Arch Linux (linux 5.11.1)
also i use tmux and remote directory (IMAP)

@komond
Copy link

komond commented Mar 1, 2021

@txgk , neomutt is now downloading attachments three times for me as well. I am now using version 20201127-27-665b82 on ubuntu, in conjunction with "screen". Earlier I used to use version 20191207, and that used to download two times.

@gahr
Copy link
Member

gahr commented Mar 1, 2021

You can use message_cachedir to cache bodies.

@komond
Copy link

komond commented Mar 1, 2021

You can use message_cachedir to cache bodies.

Thank you. It seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants