I have code that sends emails to users from a signup webpage. Occasionally, users will mistype an email address and the address ends up having a bad domain.
I would love to be able to check to see if the domain is bad BEFORE calling the System.Net.Mail.SmtpClient.Send() method since this would lead to a better user experience. I think using AJAX to tell the user right away their email won't send without having to programmatically send an email before finding out it is bad is much more elegant.
I currently handle the error just fine so please don't discuss how to handle errors. The error I get is: "Mailbox unavailable. The server response was: : Recipient address rejected: Domain not found"
Does anyone know of a way that would use similar (or the same exact) code to verify if a domain is bad or not before calling the Send() method?