def createDataManager(self, fromaddr, toaddrs, message): maildir = Maildir(self.queuePath, True) msg = maildir.newMessage() msg.write('X-Zope-From: %s\n' % fromaddr) msg.write('X-Zope-To: %s\n' % ", ".join(toaddrs)) msg.write(message) return MailDataManager(msg.commit, onAbort=msg.abort)
def test_newMessage(self): from zope.app.mail.maildir import Maildir from zope.app.mail.interfaces import IMaildirMessageWriter m = Maildir('/path/to/maildir') fd = m.newMessage() verifyObject(IMaildirMessageWriter, fd) self.assert_(fd._filename.startswith( '/path/to/maildir/tmp/1234500002.4242.myhostname.'))