postfix.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:sauna 作者: NicolasLM 项目源码 文件源码
def _fetch_showq(self):
        """Connect to Postfix showq inet daemon and retrieve queue.

        This method is faster than executing mailq because it doesn't fork
        processes.
        It requires to have showq inet daemon activated which is not the case
        by default. To make showq listen on the loopback interface on port
        4280, add to your master.cf:
        127.0.0.1:4280     inet  n       -       -       -       -       showq
        """
        showq = bytes()
        with socket.create_connection((self.config['host'],
                                       self.config['port']),
                                      timeout=self.config['timeout']) as s:
            while True:
                buffer = bytearray(4096)
                bytes_received = s.recv_into(buffer)
                if bytes_received == 0:
                    break
                showq += buffer
        return showq.decode(encoding='utf-8')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号