Skip to content

Instantly share code, notes, and snippets.

@larsar
Created April 26, 2016 10:17
Show Gist options
  • Save larsar/9787432ffbc01803d2418a8d4c822f2e to your computer and use it in GitHub Desktop.
Save larsar/9787432ffbc01803d2418a8d4c822f2e to your computer and use it in GitHub Desktop.
Check user authentication with SMTP
#!/usr/bin/env bash
[[ $@ ]] || {
printf "Usage\n\t./$0 server username password\n"
exit 1
}
SERVER=$1
MAILUSER=$2
PASSWORD=$3
AUTH_STRING=`echo -n -e "$MAILUSER\0$MAILUSER\0$PASSWORD" | openssl base64 -e`
{
sleep 1
echo "EHLO $HOSTNAME"
sleep 1
echo "AUTH PLAIN $AUTH_STRING"
sleep 5
echo "QUIT"
} | telnet $SERVER 587
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment