Lazarus

Free Pascal => General => Topic started by: Thinus on August 07, 2019, 04:23:34 pm

Title: How can I ping an email address and get result?
Post by: Thinus on August 07, 2019, 04:23:34 pm
I want to "ping" an email address and get a result such as "true" / "false" about the existence of that email.

Anyone with some idea how to test an email address without actually sending an email?

Thanks.

<place inspirational quote here>
Title: Re: How can I ping an email address and get result?
Post by: 440bx on August 07, 2019, 04:53:47 pm
Remember... Google is your friend

The information in this link may be helpful to you https://www.labnol.org/software/verify-email-address/18220/ (https://www.labnol.org/software/verify-email-address/18220/)
Title: Re: How can I ping an email address and get result?
Post by: jamie on August 07, 2019, 08:35:18 pm
 :D
Title: Re: How can I ping an email address and get result?
Post by: Remy Lebeau on August 07, 2019, 09:09:43 pm
The information in this link may be helpful to you https://www.labnol.org/software/verify-email-address/18220/ (https://www.labnol.org/software/verify-email-address/18220/)

That article uses the SMTP RCPT TO command to check if an email address is acceptable locally or will be forwarded to another server.  Many SMTP servers implement the SMTP VRFY command, which checks if a specified mailbox name exists or not.  Indy's TIdSMTP component has a Verify() method for that command.

You can use Indy's TIdDNSResolver component to retrieve the MX records for the email address's domain, then connect to each SMTP server and query the email address's mailbox name until one of the servers reports success, or until the server list is exhausted.
Title: Re: How can I ping an email address and get result?
Post by: 440bx on August 07, 2019, 09:34:35 pm
... connect to each SMTP server and query the email address's mailbox name until one of the servers reports success, or until the server list is exhausted.
Definitely.  What I wonder is, why the OP wants to "ping" an email address.  Seems to be something that only a "would be" spammer would want to do.

Title: Re: How can I ping an email address and get result?
Post by: jamie on August 08, 2019, 02:18:37 am
and the connection is made!
Title: Re: How can I ping an email address and get result?
Post by: Remy Lebeau on August 08, 2019, 03:41:00 am
What I wonder is, why the OP wants to "ping" an email address.  Seems to be something that only a "would be" spammer would want to do.

Agreed.  Unless he's writing a non-spamming bulk mailer for corporate use, but even then, I would suggest relying on bounce replies to detect non-existing addresses.  There is really no good reason for end users to ever do this.
Title: Re: How can I ping an email address and get result?
Post by: Thaddy on August 08, 2019, 07:26:57 am
Relying on bounce replies in a corporate setting should not work. Properly implemented email IT will just drop, not bounce.
Same reason ping would not work.
Title: Re: How can I ping an email address and get result?
Post by: Thinus on August 08, 2019, 09:47:45 am
Thanks for the replies.  Will look into each.

Just to clarify:  I am not into the hacking/spamming business.  My team and I try to find them though and hunt them down (figuratively speaking of course).

Currently doing work for client with vendor and client databases in excess of million entries.

We want to clean database and highlight potential risky entries, thus we are comparing various data fields to other web sources (of which email addresses are one).  Using Lazarus as a tool to deal with the project as effectively as possible.

I might ask a stupid question here and there (when Google cannot provide an answer), because my Pascal knowledge was solid until about Turbo Pascal 3 (giving away my age there).

But I understand the concern.

Regards from cold and wet Cape Town!




Title: Re: How can I ping an email address and get result?
Post by: Thaddy on August 08, 2019, 10:07:56 am
Well, you can verify the domain part of the email addresses against the various ban lists available.
That would filter out many dubious addresses.
But usually dubious email addresses are spoofed anyway, so you would need to examine the headers too.

There are also many domains that do not exist anymore, so you should also verify with a DNS look-up. That will also reveal additional info that might be of use.
Title: Re: How can I ping an email address and get result?
Post by: trev on August 08, 2019, 12:33:21 pm
Many SMTP servers implement the SMTP VRFY command, which checks if a specified mailbox name exists or not.

The first thing any SysAdmin worth his salt does is disable VRFY.
Title: Re: How can I ping an email address and get result?
Post by: Thaddy on August 08, 2019, 02:19:39 pm
Many SMTP servers implement the SMTP VRFY command, which checks if a specified mailbox name exists or not.

The first thing any SysAdmin worth his salt does is disable VRFY.

Indeed. Just drop. +10

@Remy Lebeau
You are an expert (an esteemed expert in my view) but that advice would not make it through any current security scan.
VRFY is an attack surface. It invokes a server response. As such it can easily be used for a flooding attack.
Do not focus on what is possible - protocol-wise - but on what is best practice, server-side: can't resolve ...ignore! NEVER respond.
Keep up the good work.
Title: Re: How can I ping an email address and get result?
Post by: Remy Lebeau on August 13, 2019, 07:55:00 pm
You are an expert (an esteemed expert in my view) but that advice would not make it through any current security scan.

I'm just a lowly coder monkey, not a trained system admin.
TinyPortal © 2005-2018