Easies way to test if the problem is just server config is by using the server IP instead of the server address. For example, use 127.0.0.1 instead of localhost. If that works, then the problem is nslookup.
PD: Remember that localhost in port 25 won't resolve unless you have configured "localhost" (not 127.0.0.1) to listen in port 25.