Created
March 31, 2014 01:57
-
-
Save sstelfox/9883715 to your computer and use it in GitHub Desktop.
Quick little script for testing whether or not a mail server is setup correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SMTP_SERVER='mail.example.tld' | |
| EMAIL_FROM="$(whoami)@$(hostname)" | |
| EMAIL_DESTINATION='[email protected]' | |
| cat << EOM | nc -C ${SMTP_SERVER} 25 | |
| EHLO $(hostname) | |
| MAIL FROM: ${EMAIL_FROM} | |
| RCPT TO: ${EMAIL_DESTINATION} | |
| DATA | |
| From: $(grep -P "^$(whoami):" /etc/passwd | cut -f5 -d:) <${EMAIL_FROM}> | |
| To: <${EMAIL_DESTINATION}> | |
| Date: $(date +"%a, %d %b %Y %H:%M:%S %z (%Z)") | |
| Subject: A Simple Test Message | |
| This is a message for testing whether a mail server is setup correctly or not. | |
| . | |
| QUIT | |
| EOM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment