blob: 503ad9e15289af74c504b3dfc5f2e850cbf1d9a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import mailbox
class Mailbox(mailbox.UnixMailbox):
# msg should be an rfc822 message or a subclass.
def AppendMessage(self, msg):
# seek to the last char of the mailbox
self.fp.seek(1,2)
if self.fp.read(1) <> '\n':
self.fp.write('\n')
self.fp.write(msg.unixfrom)
for line in msg.headers:
self.fp.write(line)
if msg.body[0] <> '\n':
self.fp.write('\n')
self.fp.write(msg.body)
|