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) msg.close() return MailDataManager(msg.commit, onAbort=msg.abort)
def test_newMessage(self): from repoze.sendmail.maildir import Maildir from repoze.sendmail.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.'))
def test_newMessage(self): from repoze.sendmail.maildir import Maildir from repoze.sendmail.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.'))