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. To enable the feature for testing, go into Preferences -> Advanced -> General -> Config Editor and change mailnews.sendInBackground to true and restart Thunderbird. (Note, to have a "silent" send in background, one should also set mailnews.show_send_progress to false which stops showing of the send 'progress' window.)

The following parts are implemented:

  • Basic send in background.
    • Sending a message will temporarily (for about a second) put it in the Outbox in Local Folders, and then Thunderbird will attempt to send it.
  • 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 parts are not yet implemented (for more details see the open bugs which block bug 511079):

  • If there is an error, Thunderbird does not yet attempt to automatically send the message a second time (until another message is sent).
  • If there are multiple messages queued, Thunderbird does not yet attempt to automatically send other messages that are queued.
  • Thunderbird does not yet 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.