From MozillaWiki
Jump to: navigation, search

Feature Name: "Send In Background"

Current Developer: Mark Banner (Standard8)

Relevant Bugs: bug 440794

High Level Description

The idea is that when a user sends an email, they don't want to have to wait for the email to be sent before getting on with the next task. The intention is to utilise Thunderbird's existing "Send Later" mechanism to send the emails in the background with some added automation.

Note that the existing Send Later mechanism remains intact.

The added advantage of sending in the background, is that if there is an error then the code can automatically handle that and proceed with sending other emails, and/or wait until a bit later to try again. If there are persistent failures, then Thunderbird should alert the user.

One area we have to be careful with is shutdown - if Thunderbird is in the process of sending an email, we shouldn't abort that - but allow it to be finished (whilst also informing the user). Additionally, if emails are waiting to be sent, we should potentially alert about those as well.

Current Status

The feature is currently disabled by default due to pieces that are not yet implemented. Several people use it successfully, but within the limitations listed below of what is not yet implemented - so use at your own risk. To enable the feature for testing:

  • go to Preferences -> Advanced -> General -> Config Editor
    • change mailnews.sendInBackground to true to enable asynchronous sending
    • (recommended) change mailnews.show_send_progress to false to stop showing the send 'progress' window
  • restart Thunderbird

The following parts are implemented:

  • Basic send in background.
    • Sending a message will put the message in the Outbox in Local Folders, and then Thunderbird will attempt to send it. Once successfully sent, the message is removed from Outbox.
  • Activity Manager progress and notifications
    • The activity manager will echo progress and notifications of sending messages in the background (or via Send Later).
  • Partial shut down support.
    • Sending a message and attempting to quit should bring up a dialog which is retained until the message is sent. On Windows and Linux this will only happen if File -> Quit is used not the 'x' on the window.

Partial list of functions not yet working / implemented (see the open bugs which block bug 511079 for more detail):

  • If there is an error, Thunderbird does not attempt to automatically send the message again (at least, not until another message is sent).
  • If multiple messages are queued, Thunderbird does not attempt to automatically send messages that are queued behind a failing message.
  • Thunderbird does not notify the user if messages are being sent during shutdown.

Test Steps

(Note: read the current status above in conjunction with this section).

When the feature lands, sending of messages should happen pretty much straight away - once the message is copied to disk, the compose window should be automatically closed and then the only updates will be the message send progress.

Sending from different identities within different accounts should happen without issue.

Shutdowns of Thunderbird should not cause data loss - messages should be completely sent unless the user cancels them, and copied to the sent mail folder.

If shutting down with pending messages, Thunderbird should notify the user.

Thunderbird will try to send messages multiple times if they fail. After TBD attempts, Thunderbird will alert the user.

For testing purposes, we're going to maintain the set of activity manager events, and their categorization (error, events, processes) here.