How to use the aiosmtpd.const.LINE_TERM.join function in aiosmtpd

To help you get started, we’ve selected a few aiosmtpd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiosmtpd / aiosmtpd / streams.py View on Github external
access_log.debug("Data line read: %r", line)

            if line == const.DATA_TERM:
                break

            if line.startswith(b'.'):
                line = line[1:]

            data_length += len(line)
            if max_len and data_length > max_len:
                access_log.error('Too much data: %i bytes', data_length)
                raise errors.TooMuchDataError()

            lines.append(line)

        result = const.LINE_TERM.join(lines)
        if max_len and len(result) >= max_len:
            raise errors.TooMuchDataError()

        return result
github aio-libs / aiosmtpd / aiosmtpd / protocol.py View on Github external
if not helo:
            yield from self.send(b'501 Syntax: EHLO hostname')
            return

        if arg:
            # TODO: Implement arg handling.  Is that even legal SMTP?
            pass

        self._is_esmtp = True
        self._helo = helo
        resp_lines = [b'250-' + self._fqdn]
        if self._max_size:
            sz = bytes(str(self._max_size), 'ascii')
            resp_lines.append(b'250-SIZE ' + sz)
        resp_lines.append(b'250 HELP')
        resp = const.LINE_TERM.join(resp_lines)
        yield from self.send(resp)