1

I have my own application which generates messages to be saved in the Drafts folder of Thunderbird. Actually, I just append to the Drafts file, but it doesn't seem right to open a file Thunderbird already has opened.

As a result, Thunderbird doesn't realise that there are new messages in the Drafts folder, and of course the Drafts.msf file isn't current. After closing and restarting Thunderbird, the new messages show.

My question is now: Is there a better way to provide drafts to users? Just triggering Thunderbird to re-read the Drafts file and rebuild the .msf index would be fine, I think.

Right now I am doing this on Linux, is there anything specific if I want to do the same on Windows?

I don't want to use the -compose on the command line, because it would open too many windows when I insert a lot of draft messages.

Holger Jakobs
  • 984
  • 3
  • 11
  • 32
  • possible duplicate of [Mailto: Body formatting](http://stackoverflow.com/questions/11507387/mailto-body-formatting) – Donal Fellows Mar 28 '14 at 14:36
  • Nope, far away! I dont't want to create a link which can be clicked manually to pop up a compose mail window. Nor do I want to call "thunderbird -compose" to pop up a mail window automatically. I want to inject a message including pictures into the drafts folder which later can be opened and amended by users before being sent off. – Holger Jakobs Mar 28 '14 at 18:15

2 Answers2

0

If case you don't mind creating an add-on for Thunderbird to do this:

Thunderbird add-ons can react to custom command line arguments, see https://developer.mozilla.org/en-US/docs/Chrome/Command_Line for more details.

In the add-on you could then either insert the e-mail to the draft folder or trigger the re-read of the Drafts file.

user228011
  • 541
  • 3
  • 6
  • Of course I wouldn't mind creating an add-on, if only there was some documentation about it without lots of warnings that most of it is outdated. I have been unable to find any documentation about an API telling how to trigger the re-read of a file like the Drafts folder. – Holger Jakobs Apr 16 '14 at 19:55
  • Yes, the Thunderbird development documentations is rather bad. The API for a folder in described here: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMsgFolder. i havened tried it, but updateFolder may be right function to use. If that doesn't work you could use the rebuildSummary function: https://mxr.mozilla.org/comm-central/source/mail/base/content/folderPane.js#2075. This is the one used to repair the .msf file. – user228011 Apr 17 '14 at 00:16
0

Actually, my solution to the problem is unrelated to Thunderbird. Instead of fiddling with Thunderbird, I communicate directly with the IMAP server to write a new draft mail into the "Drafts" folder.

Thunderbird (or other clients, for that matter) picks up the new draft mails and the user can handle them.

Holger Jakobs
  • 984
  • 3
  • 11
  • 32