hello i'm developing a mail server and i would like to know that how can i
send the e-mail to the other hosts like hotmail and yahoo.

suppose the mail server receives a mail from the client addressed to xyz@yahoo.com
, so how come i know the ip of mailserver of yahoo.
so that i can connect to the server of yahoo and send the mail using smtp
protocol. is there any command or anything that provides the information.
pls help its urgent