Logo Search packages:      
Sourcecode: zope-passwordresettool version File versions  Download package


import email
from Products.MailHost.MailHost import MailHost as MailBase

00004 class MockMailHost(MailBase):
    """A MailHost that collects messages instead of sending them.

    Thanks to Rocky Burt for inspiration.
    def __init__(self, id):
        MailBase.__init__(self, id)
    def reset(self):
        self.messages = []
00017     def send(self, message, mto=None, mfrom=None, subject=None, encode=None):
        Basically construct an email.Message from the given params to make sure
        everything is ok and store the results in the messages instance var.

        message = email.message_from_string(message)
        message['To'] = mto
        message['From'] = mfrom
        message['Subject'] = subject
        self._p_changed = True

    def validateSingleEmailAddress(self, address):
        return True # why not

Generated by  Doxygen 1.6.0   Back to index