nslookup works but ping doesn't

I have a server running Debian etch. It runs qmail and sends mail. Mail server works correct but the strange thing is from server itself it can't resolve hostnames. I can use nslookup and dig correctly.

#ping google.com
ping: unknown host google.com


#dig google.com

; <<>> DiG 9.2.4 <<>> google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64443
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             300     IN      A       209.85.229.104
google.com.             300     IN      A       209.85.229.105
google.com.             300     IN      A       209.85.229.106
google.com.             300     IN      A       209.85.229.147
google.com.             300     IN      A       209.85.229.99
google.com.             300     IN      A       209.85.229.103

;; AUTHORITY SECTION:
google.com.             134830  IN      NS      ns1.google.com.
google.com.             134830  IN      NS      ns2.google.com.
google.com.             134830  IN      NS      ns3.google.com.
google.com.             134830  IN      NS      ns4.google.com.

;; ADDITIONAL SECTION:
ns1.google.com.         105732  IN      A       216.239.32.10
ns2.google.com.         105732  IN      A       216.239.34.10
ns3.google.com.         105732  IN      A       216.239.36.10
ns4.google.com.         105732  IN      A       216.239.38.10

;; Query time: 172 msec
;; SERVER: 212.175.236.100#53(212.175.236.100)
;; WHEN: Sun Dec 20 00:39:35 2009
;; MSG SIZE  rcvd: 260

There is a point that i'm suspicious of is there is a package that was installed not used by another application called resolvconf. And is creates a symlink to original resolv.conf file.
My iptables list is empty.


Your /etc/nsswitch.conf file should contain a like like this, to enable dns lookups.

hosts:       files dns

Dig is a DNS utility so it checks DNS. qmail might also be ignoring nsswitch.conf. Most other programs that use standard DNS calls in C library honor it. If yours dows not contain "dns" in it, it is pretty normal that DNS lookups don't work for most things.