7.3.2.2 mboxMessage
- A message with mbox-specific behaviors. Parameter message has the same meaning as with the Message constructor.
Messages in an mbox mailbox are stored together in a single file. The sender's envelope address and the time of delivery are typically stored in a line beginning with "From " that is used to indicate the start of a message, though there is considerable variation in the exact format of this data among mbox implementations. Flags that indicate the state of the message, such as whether it has been read or marked as important, are typically stored in Status: and X-Status: headers.
Conventional flags for mbox messages are as follows:
Flag | Meaning | Explanation |
---|---|---|
R | Read | Read |
O | Old | Previously detected by MUA |
D | Deleted | Marked for subsequent deletion |
F | Flagged | Marked as important |
A | Answered | Replied to |
The "R" and "O" flags are stored in the Status: header, and the "D", "F", and "A" flags are stored in the X-Status: header. The flags and headers typically appear in the order mentioned.
mboxMessage instances offer the following methods:
- Return a string representing the "From " line that marks the start of the message in an mbox mailbox. The leading "From " and the trailing newline are excluded.
-
Set the "From " line to from_, which should be specified without a
leading "From " or trailing newline. For convenience, time_ may be
specified and will be formatted appropriately and appended to from_. If
time_ is specified, it should be a struct_time instance, a tuple
suitable for passing to time.strftime(), or
True
(to use time.gmtime()).
- Return a string specifying the flags that are currently set. If the message complies with the conventional format, the result is the concatenation in the following order of zero or one occurrence of each of "R", "O", "D", "F", and "A".
- Set the flags specified by flags and unset all others. Parameter flags should be the concatenation in any order of zero or more occurrences of each of "R", "O", "D", "F", and "A".
- Set the flag(s) specified by flag without changing other flags. To add more than one flag at a time, flag may be a string of more than one character.
- Unset the flag(s) specified by flag without changing other flags. To remove more than one flag at a time, flag maybe a string of more than one character.
When an mboxMessage instance is created based upon a MaildirMessage instance, a "From " line is generated based upon the MaildirMessage instance's delivery date, and the following conversions take place:
Resulting state | MaildirMessage state |
---|---|
R flag | S flag |
O flag | "cur" subdirectory |
D flag | T flag |
F flag | F flag |
A flag | R flag |
When an mboxMessage instance is created based upon an MHMessage instance, the following conversions take place:
Resulting state | MHMessage state |
---|---|
R flag and O flag | no "unseen" sequence |
O flag | "unseen" sequence |
F flag | "flagged" sequence |
A flag | "replied" sequence |
When an mboxMessage instance is created based upon a BabylMessage instance, the following conversions take place:
Resulting state | BabylMessage state |
---|---|
R flag and O flag | no "unseen" label |
O flag | "unseen" label |
D flag | "deleted" label |
A flag | "answered" label |
When a Message instance is created based upon an MMDFMessage instance, the "From " line is copied and all flags directly correspond:
Resulting state | MMDFMessage state |
---|---|
R flag | R flag |
O flag | O flag |
D flag | D flag |
F flag | F flag |
A flag | A flag |
See About this document... for information on suggesting changes.