Here's the 3 Line code to get IP From Host Name Dim IPAddress() As System.Net.IPAddress IPAddress = System.Net.Dns.GetHostAddresses("smtp.mail.yahoo.com") Dim oSmtpClient As New SmtpClient oSmtpClient.Host = IPAddress(0).ToString