mail block 여부를 확인해야하는데 telnet 연결을 하면 block이 되더라도 연결은 성공이기 때문에 $? 값이 0 으로 참이다 ㅡㅜ 
($? will contain the exit status of the last command)
그래서 메시지로 확인을 해야하는 경우가 있어 구글링해봄


# exec 3<>/dev/tcp/mx4.naver.com/25

# RESPONSE="`cat <&3`"

# echo "Response is: $RESPONSE"

Response is: 220 mx.naver.com ESMTP uhOoOzccQ6eHbxMheoMwfA - nsmtp

451 4.4.2 Timeout - closing connection uhOoOzccQ6eHbxMheoMwfA - nsmtp


# exec 3<>/dev/tcp/mx4.naver.com/25

# RESPONSE="`cat <&3`"

# echo "Response is: $RESPONSE"

Response is: 421 4.3.2 Your ip blocked from this server O8n3JcaPR-SkE+jwsts6GA - nsmtp 



if [[ "$RESPONS" =~ "blocked" ]]; then

    echo "blocked"

else

    echo "ok"

fi



+ Recent posts