Debug SMTP server
#!/bin/sh | |
# Start a debug SMTP server using Python's smtpd module | |
show() { | |
echo 1>&2 "$@" | |
} | |
port=${1-25} | |
smtpd_args="-c DebuggingServer localhost:$port" | |
if [ $(whoami) != "root" ]; then | |
smtpd_args="-n $smtpd_args" | |
if [ $port -lt 1024 ]; then | |
show "Listening on TCP port below 1024 requires root." | |
show "Did you mean \`sudo $0\`?" | |
exit 1 | |
fi | |
fi | |
show "Running on port $port..." | |
python -m smtpd $smtpd_args | |
show "Terminated." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment