Feature #2

Download attachments on demand

Added by Vladimir Smolyar about 5 years ago. Updated 2 months ago.

Status:In ProgressStart date:11/15/2011
Priority:NormalDue date:
Assignee:Hiroyuki Yamamoto% Done:


Category:-Spent time:-
Target version:-


Below follows actually the quote of my message to Sylpheed mailing list which hasn't ever got any response.

I would like to suggest a slightly changed way of e-mails with attachments treatment.
The problems is: it often happens that a person receives an e-mail with some files attached and wants just to read the text message in such letter rather than downloading it with all the files attached. In my case the current Sylpheed behaviour (downloading all the attachments when I click on the message to see the text) is very inconvenient since I have a very slow connection and have to pay for the amount of traffic I used.
It would be very very nice if you introduced an option to download the attachments only on demand. For example, when I click "Save as..." for some of the attached files.
It doesn't seem as a hard-to-implement feature, but it could make life much more comfortable for a lot of people I believe.

Thank you.


#1 Updated by Hiroyuki Yamamoto about 5 years ago

  • Status changed from New to In Progress
  • Assignee set to Hiroyuki Yamamoto

I suppose you mentions IMAP messages.
I will add an option to download only text part and a feature to download attachments
on demand in the future release.

#2 Updated by Andrey Gursky over 4 years ago

Without such a feature it is impossible to use sylpheed on low-bandwidth networks. Assuming sylpheed is a light-weight client, this feature is essential.
It would be excited if you add it!

Thank you,

#3 Updated by Genghis Khan over 1 year ago

I use Linux, and when I see a spam message with an .exe file, I know I have nothing to do with it. I would love to just delete such messages without downloading their attachments.

#4 Updated by Andrey Gursky about 1 year ago

Hiroyuki Yamamoto wrote:

I will add an option to download only text part and a feature to download attachments
on demand in the future release.

are you working on it?


#5 Updated by Andrey Gursky about 1 year ago

Few years ago I gave up with sylpheed. Now the question is again to give up or not to give up. I would switch to claws-mail, but they have the same problem [1], though recently one figured out, that libetpan supports this already, but not claws-mail itself. Would it be easier to integrate it there? Or should I give a chance trojita. Maybe it supports this out-of-the-box...

Ok, I've looked into the code. And I would propose the following:
- In imap_get_uncached_messages / imap_get_uncached_messages_func (libsylph/imap.c) fetch also BODYSTRUCTURE. This gives us full information of mail parts (and attachments' filenames). The headers should be written to the cache file.
- In imap_cmd_fetch (libsylph/imap.c) fetch not BODY.PEEK[] but BODY.PEEK[#num1.#num2], where #num1 and so on are the IDs from BODYSTRUCTURE, which are either text/plain or text/html. Append the result to the cache (the headers are already there).
- Once user clicks on the attachment and it is not yet in the cache, a question should arise to confirm the downloads. This part will be fetched, the content of the saved cached loaded and parsed and the content of the attachment should be inserted in the raw message, as it would be downloaded as whole. Then save the cache file. Ideally, once user downloads all attachments, the cache file should look exactly as it is now.

I see plugin/attachment_tool/attachment_tool.c can already manipulate the cache file. Perhaps it could be extended with additional "add" operation?

[1] http://www.thewildbeast.co.uk/sylpheed-claws/bugzilla/show_bug.cgi?id=2035

#6 Updated by Andrey Gursky 2 months ago

Meanwhile I've implemented a hack to fix this: for now without dealing with BODYSTRUCTURE. There are 2 known issues:
  1. Messages consisting of only attachments without text BODY at all will be downloaded.
  2. MS Exchange IMAP Server seems to not support BODY.PEEK[1.HEADER], I need due to multipart messages. Any clue, is it a bug or there is better replacement?

If you have suggestion, where to place an option for enable/disable attachment downloading, which can be accessed in imap.c, I would add it.

#7 Updated by Andrey Gursky 2 months ago

Updated URL of the corresponding bug report for Claws Mail: http://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=2035 (don't download attachments when opening mail for reading)

#8 Updated by Andrey Gursky 2 months ago

The option to enable/disable attachments download would be only useful, if we add a function to redownload a selected message. Once only text part has been saved, Sylpheed treats this email as downloaded. When you decide you want also attachments, you'd need to enable attachments download and force Sylpheed to redownload the message.

Also available in: Atom PDF