?
Solved

C# Is there a way to get IP address from the mail server name?

Posted on 2005-04-14
2
Medium Priority
?
296 Views
Last Modified: 2011-09-20

I have a C# windows forms app in the email function I am using the smtpmail object to send the mail.  However, it does not work when I set the stmpmail.servername = "mail.servername.com"  it only works if I put the IP address.  Is there a way to get IP address from the mail server name?
0
Comment
Question by:Jenny12345
2 Comments
 
LVL 3

Accepted Solution

by:
wishguitar earned 400 total points
ID: 13782862
IPHostEntry hostEntry = Dns.GetHostByName("mail.comcast.net");
if (hostEntry != null)
{
      foreach (IPAddress address in hostEntry.AddressList)
            Console.WriteLine(address.ToString());
}
0
 

Author Comment

by:Jenny12345
ID: 13784109
yes this works great  - thank you
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses
Course of the Month17 days, 3 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question