Link to home
Start Free TrialLog in
Avatar of cyberman05
cyberman05

asked on

DNS LOOKUP AND EMAIL VERIFY?

I'm referring to this question:

https://www.experts-exchange.com/questions/22815265/Delphi-5-How-to-verify-an-email-address.html

Can anybody send me the code how to verify email addresses in Delphi 6 or 7 using Indy DNS?
Avatar of Johnjces
Johnjces
Flag of United States of America image

You need to be a bit more informative.

Do you want to verify the username part of username@somedomain.com or the domain and or an smtp (email) server on that domain?

As in the post you are referring to, the Finger protocol is not enabled in probably 100% of all email servers.

You can "ping" port 25 on a domain name and ascertain if an smtp server exists but that would not check for a username.

If you want to check for port 25 on a domain, check out the answer provided on the Q here at EE.

https://www.experts-exchange.com/questions/24885223/Check-if-a-website-is-down-or-not.html

In the accepted answer, use port 25 and the HostIP can be the IP OR the domain, like mydomain.com.

DO NOT USE OpenDNS as you wil always get a port 80 return and they will always return an IP (theirs) for a bad or non existent domain.

As an exampe of this code working, download and check out PTLogger from my website at

http://www.jcitssystems.com/PTLogger.htm

John
Avatar of cyberman05
cyberman05

ASKER

Thanks. Wait. I found the Indy sample to resolve DNS. I think this is what I'm looking for. I'll try to figure this by myself. If I can't I'll let you know.
No I can't make it. It doesn't work reliably. I need help. I want to verify if email is valid. How do I do that? I should probably check if domain exists at first place and if it has DNS server or how? Some code would be greatly appreciated.
You can't ensure that an email is valid, i.e. bobjones@mycompany.com.

So I am confused about what you need/want  to do.

Why is not checking port 25 for an SMTP (email) server not reliable?

If you just wnat to see if a domain exists, you could just ping it wiht an ICMP ping (component is there under Indy).

Can you step us through what exactly it is you desire to do? (It might be obvious, but I am missing it at this point in time).

John
Ok I want to do a simple email verifier application. I want to have an application that would tell me if certain email exists before I send it. So, I have an email me@company.com and I want to verify if when I sent this email is it going to return to me as error "can't be delivered error 550 or whatever" or is it actually going to be delivered to the recipient. How do I do that? I need your suggestions. I already tried with InternetCheckConnection on the email domain but it doesn't work reliably. Is pinging reliable? How do I check port 25 if SMTP server exists? I need some code. What if I'd try to check if DNS server exists? Is this a reliable way of telling if the domain part of an email exists? I want 100% bulletproof method.
I don't like the ping solution. I get socket error 1104.
Simply put, you will not be able to check if an email address from any SMTP server (anymore) lives.  That was a function of the defunct finger protocol. Too much abuse, spam and all that stuff made email addresses a bit harder to get and the demise of any server alowing 'fingers' (finger protocol).

The best you will be able to do is check a domain name, i.e. mydomain.com to see if that domain has an SMTP (email) server. If not, then no email can be received.  That would be port 25.

I give code in the following EE Question.

https://www.experts-exchange.com/questions/24885223/Check-if-a-website-is-down-or-not.html

use port 25 as the port and the domain name you want to check. If it returns OK then at least you know that a mail server is present. There are other ways such as check for a DNS MX record, but checking whether port 25 will open is just as reliable.

Sorry but to be succinct, there is no way to find out before hand whether an email address is valid or whether an email will reach a recipient at the end of any given email address.

John
Yes that website is exactly what I already tried to do. As I said in my previous post Internetcheckconnection doesn't work reliably. And I don't like pinging solution since I find it unreliable also. Simply because of timeout option. Can you give me the code how to get DNS MX record?
I am not speaking of INternetCheckConnection.

Look at the accepted answer. It is above the one you are referring. Should have a green "Accepted Solution" Bar.

John
As I already said I'd very much prefer the solution with DNS MX records.
But, you still cannot verify an email address. An MX Record is just showing you that an email server exists. It might return as:

mail.mydomain.com
mx1.mydomain.com

and etc.

Good Luck!

John
Solved by myself. Please delete and refund.
How did you solve this? There are others that would like to know and we would all like to learn.

To have any refund, you will have click the Request Attention button and you may have to provide your solution so that the moderators can make a determination of how you solved this.

John
ASKER CERTIFIED SOLUTION
Avatar of cyberman05
cyberman05

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial