summaryrefslogtreecommitdiff
path: root/Mailman/Mailbox.py
blob: 580f1f290030ba2c2d7d4e83c573d1f06b4c0f51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"Extend mailbox.UnixMailbox."

__version__ = "$Revision: 399 $"


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)