We help IT Professionals succeed at work.

DNS LOOKUP AND EMAIL VERIFY?

cyberman05
cyberman05 asked
on
772 Views
Last Modified: 2013-11-23
I'm referring to this question:

https://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_22815265.html

Can anybody send me the code how to verify email addresses in Delphi 6 or 7 using Indy DNS?
Comment
Watch Question

Commented:
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/Programming/Languages/Pascal/Delphi/Q_24885223.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

Author

Commented:
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.

Author

Commented:
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.

Commented:
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

Author

Commented:
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.

Author

Commented:
I don't like the ping solution. I get socket error 1104.

Commented:
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/Programming/Languages/Pascal/Delphi/Q_24885223.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

Author

Commented:
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?

Commented:
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

Author

Commented:
As I already said I'd very much prefer the solution with DNS MX records.

Commented:
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

Author

Commented:
Solved by myself. Please delete and refund.

Commented:
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
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.