Last active
January 29, 2019 06:38
-
-
Save ziozzang/5f646910bc11d90afc3a1afa6d240b41 to your computer and use it in GitHub Desktop.
Simple SMTP test with shell script(bash)
This file contains 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 | |
EMAIL_BODY="Test from telnet - $(LANG=c date)" | |
EMAIL_SUBJECT="Telnet test - $(LANG=c date)" | |
SMTP_SERVER="smtp.some.server" | |
SMTP_PORT="25" | |
MAIL_TO="asdf@foo.com" | |
MAIL_FROM="asdf@bar.com" | |
echo ">> ${my_email_subject}" | |
nc ${SMTP_SERVER} ${SMTP_PORT} << EOF | |
EHLO simple.bash.client | |
MAIL FROM:${MAIL_FROM} | |
RCPT TO:${MAIL_TO} | |
DATA | |
FROM:${MAIL_FROM} | |
TO:${MAIL_TO} | |
SUBJECT: ${EMAIL_SUBJECT} | |
${EMAIL_BODY} | |
. | |
QUIT | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment