mozdev.org

Mail Tweak

resources:

Defer

The Defer tweak defers messages until a later time. It is only available in Thunderbird 3.

To defer one or more received messages, select the messages and choose Message Defer. Specify a time in the future. The messages move to the Deferred subfolder of your Outbox. When the future time arrives, Mail Tweak moves the message back to your Inbox for you to deal with.

To defer an outgoing message, write the message and choose File Defer. Specify a time in the future. The message is stored in the Deferred subfolder of your Outbox. When the future time arrives, Mail Tweak moves the message back to your Outbox, then it sends all the messages in your Outbox.

To specify a time, you can either press one of the preset buttons, or you can specify a time and date and then press OK. To see the actual date and time represented by a preset button, hover your mouse pointer over the button until its tooltip pops up.

Notes:

Default time

You can configure the default time in the Defer dialog. Filter the Config Editor for: extension.mailtweak.defer.time and specify a time using the notation for presets described below. The default setting for the default time is +1:00, meaning the start of the next hour.

The default time is only used when Thunderbird starts up and you first defer a message. While Thunderbird remains running, the time in the Defer dialog remains however you last set it. When you close Thunderbird and restart it, the time resets to the default time.

Defer presets

You can configure the preset times for deferring messages by editing preference settings in the Config Editor. Filter for: extension.mailtweak.defer.preset

The presets are numbered starting from 1, and four presets are supplied by default. You can remove or edit the existing presets, or add more.

The numbering does not have to be consecutive. For example, if you remove preset 3, you do not have to change preset 4.

The defaults are: Tomorrow, Monday, In a week, Next month (all at midnight)

Each preset has two preferences a label and a spec. The label can contain any text you choose. The spec is constructed as described below.

General principles

A spec contains one or more elements separated by spaces. Each element can be a time, a date, or a weekday. The spec can include more than one element of the same type.

The elements are processed from left to right. If the first element is a time, then the result is initially the current date and time, otherwise the result is initially the current date at midnight (00:00). If an element matches the current result it does not change the result, otherwise it moves the result into the future.

An element contains one or more values. The values are processed from right to left. Each value is either a number, a number with a plus or minus sign, a comma-separated list of numbers in square brackets, or an equals sign (=).

A number with no sign indicates an absolute time, date, or weekday in the future. A number with a plus or minus sign indicates an offset forwards or backwards. A list of numbers indicates alternatives. An equals sign (=) indicates no change.

The result of processing each number value is adjusted to be in the future. For example, if the time now is 9 a.m. and you specify 10 a.m., then the result will be in one hour's time, but if the time now is already 11 a.m. and you specify 10 a.m., then the result will be tomorrow at 10 a.m.

Time elements

A time element contains two numbers separated by a colon. Times use the 24-hour clock. For example:

9:009 a.m. (today or tomorrow, depending what time it is now)
14:302:30 p.m. (today or tomorrow, depending what time it is now)
+1:=an hour from now
00:00 9:009 a.m. tomorrow (midnight, then 9 a.m.)
[9,13]:00either 9 a.m. or 1 p.m., whichever is sooner
Date elements

A date element contains three numbers separated by slashes, in the order year, month, day. For example:

=/3/1March 1st (any year, at midnight)
=/=/1the first of next month (at midnight)
=/=/[1,15]the 1st or the 15th, whichever is sooner (at midnight)
=/=/1 9:00the first of next month at 9 a.m.
=/=/+1 9:00tomorrow at 9 a.m.
Weekday elements

A weekday element is a single number. Numbers from 0 to 6 represent Sunday to Saturday. Higher numbers represent weekdays in subsequent weeks.

A plus sign or a minus sign indicates a simple number of days, regardless of weekday. For example:

1Monday (at midnight)
[1,4]Monday or Thursday, whichever is sooner (at midnight)
+1 9:00tomorrow at 9 a.m.
=/=/1 -1the last day of this month (at midnight)
=/+1/1 -1the last day of next month (at midnight)
=/=/1 1the first Monday of next month (at midnight)
=/=/1 8the second Monday of next month (at midnight)
=/=/1 [1,2,3,4,5]the 1st of next month, or the following Monday if the 1st is a Saturday or Sunday

Programming interface

You can use the Defer tweak from code in other extensions (for example, in a keyboard shortcut defined in keyconfig, or in a custom toolbar button defined in Custom Buttons). The basic code to use is the following line. The Defer dialog opens so that you can specify a time or cancel the operation:

MailTweak.Defer.setup()

You can optionally specify a date and time in the future in the same format as a preset spec. It does not have to match any of the existing presets. The Defer dialog does not open. For example, to defer for two days:

MailTweak.Defer.setup("+2")

Or you can specify a JavaScript Date object, which you can compute in any way you choose. The Defer dialog does not open if the date is in the future. For example, to defer until 4 p.m., but open the dialog if the time now is already after 4 p.m.:

var when = new Date
when.setHours(16)
when.setMinutes(0)
MailTweak.Defer.setup(when)

Feedback

For questions or comments about Mail Tweak, please use this thread in the mozillaZine Extension/Theme Releases forum: Mail Tweak (for Thunderbird)

For questions or comments not about a specific project, please read our feedback page.
Copyright © 2004, 2008 All rights reserved. Terms of Use.