#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Criticality: High Check that emails can be sent. ''' import os import subprocess import sys if not os.path.exists('/etc/postfix'): print('Postfix dir does not exists, please install postfix.') sys.exit(1) else: # check that postfix listens the port 25 correctly status, out = subprocess.getstatusoutput('netstat -pant | grep master | grep 127.0.0.1:25') if status != 0: print('The port 25 is not listened by any process.') sys.exit(1) print('Postfix listening port: OK.')