Download attachments on demand
|Status:||In Progress||Start date:||11/15/2011|
|Assignee:||Hiroyuki Yamamoto||% Done:|
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.
#5 Updated by Andrey Gursky over 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 , 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?
#6 Updated by Andrey Gursky 4 months ago
- Messages consisting of only attachments without text BODY at all will be downloaded.
- 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 4 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 4 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.