Skip to content

Instantly share code, notes, and snippets.

@michabbb
Created May 9, 2017 18:52
Show Gist options
  • Save michabbb/aa8888a6311d02abfd3370fe87b12cae to your computer and use it in GitHub Desktop.
Save michabbb/aa8888a6311d02abfd3370fe87b12cae to your computer and use it in GitHub Desktop.
Test Mailgun API Http Response Header
KEY=$1
EMAIL=$2
MD5=`echo -n "$KEY $EMAIL" | md5sum| awk '{print $1}'`
curl -o /dev/null -s -sw "%{http_code}" -G --user "api:$KEY" -G https://api.mailgun.net/v3/address/validate --data-urlencode address="$EMAIL" > /tmp/$MD5
RESPONSE_CODE=`cat /tmp/$MD5`
if [ $RESPONSE_CODE -eq 200 ]; then
echo "OK: $RESPONSE_CODE"
exit 0
else
echo "FAILED: $RESPONSE_CODE"
exit 2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment