@classmethod
def from_settings(cls, settings, prefix='mail.'):
    """Create a new instance of 'DebugMailer' from settings dict.

        :param settings: a settings dict-like
        :param prefix: prefix separating 'pyramid_mailer' settings
        """
    settings = settings or {}
    top_level_directory = settings.get(prefix + 'top_level_directory')
    if top_level_directory is None:
        raise ValueError(
            "DebugMailer:  must specify '%stop_level_directory'" % prefix)
    return cls(top_level_directory)
