This content has been marked as final. Show 1 reply
AmitChalwade123456 wrote:There's no point in doing that. Even if it responds to the ping, it may go down between the ping and sending the mail. Or it may respond to the ping, meaning the box is up, but the mail service may still be down.
in my send mail code if my mail server is invalid then it throws SocketException if i want to ping mail server before i sent email how can i do that if i want avoid this SocketException
Whether it comes from a failed ping or from an exception, the end result is the same: You can't send mail to that server right now.
Just catch the exception and handle it. Don't overcomplicate things for no gain.