Our website sends e-mails to the e-mail address which a user enters on our website. Some people enter garbage e-mail addresses. How can we find out, whether at least the host of the entered address is a valid one? Simply trying to open a socket at port 25 of the entered host?
Update: I’ve found a Java library for DNS stuff. What record should I check?
You need to look up the MX record for the host-part from DNS…but there are many corner-cases. Don’t reinvent the wheel (you’re bound to get it wrong), try to find an existing library. I only know the one from Snertsoft for C (integrated into the commercial milter-sender), though.
[Disclaimer: I’m a happy user of milter-sender]
[Edit]
Take a look at RFC 5321 Sec.5, which describes the rules for looking up the right host.