WorkHolic

SMTP 테스트(bash and telnet to test an email)

gromet 2022. 12. 17. 17:01
728x90
반응형

SMTP 테스트(bash and telnet to test an email)

 

[[ $4 ]] || {
    printf "Usage\n\t$0 <domain> <email> <from_email> <rcpt_email>\n"
    exit 1
}
{
    sleep 1
    echo "helo $2"
    sleep 0.5
    echo "mail from:<$3>"
    sleep 0.5
    echo "rcpt to:<$4>"
    echo
} | telnet $1 25 |
    grep -q "Unknown user" &&
    echo "Invalid email" ||
    echo "Valid email"

 

Usage :

./script.sh domain email from_email rcpt_email

 

https://stackoverflow.com/questions/14326350/bash-and-telnet-to-test-an-email

 

bash and telnet to test an email

I'm trying to find out whether an email address is valid. I've accomplished this by usign telnet, see below $ telnet mail.example.com 25 Trying 0.0.0.0... Connected to mail.example.com. Escape

stackoverflow.com

#SMTP #메일테스트 #bash

 

728x90
SMALL