solution should be to install and configure local dnscache
The cause of this problem is as follows:
"qmail-remote" wants to perform "CNAME" lookups of the domain names that mail is to be sent to. However, instead of doing a "CNAME" DNS lookup directly, it performs an "ANY" DNS lookup and scans the result for "CNAME" resource records. It does this because of a bug in BIND version 4 that would be triggered if it did "CNAME" lookups directly.
But "qmail" only employs a 512-byte buffer to receive the DNS response. Unfortunately, an "ANY" lookup for several popular domains (such as "aol.com.") now yields a response bigger than 512 bytes, and the DNS lookup fails because the response size exceeds the size of the buffer that "qmail" has to hold it. (An "ANY" response for "aol.com." was 543 bytes - and even that was with the "glue" stripped - at the time of writing this answer.)
Installing "dnscache" partially alleviates this problem because "dnscache" provides smaller answers to "ANY" queries than other proxy DNS server softwares, such as BIND, do. This happens to defer the onset of this problem in most cases.
However, this is not a true solution. The problem can still occur even if one employs "dnscache". The the maximum size that a DNS response can be is 65536 bytes, and "qmail"'s DNS response buffer should therefore be capable of holding responses up to this size. The correct fix is to apply Christopher K. Davis' patch that increases "qmail"'s buffer to 65536 bytes.
Whilst you are about it, you also might consider applying the patch that makes "qmail" actually use "CNAME" queries when it wants to look up "CNAME" resource records.
You can comment this FAQ