#!/bin/bash
LOG=${1:-/var/log/maillog}
grep -E "status=(deferred|bounced)|4[0-9]{2}|5[0-9]{2}" "$LOG" | tail -n 500
