Recent

Author Topic: How can I ping an email address and get result?  (Read 774 times)

Thinus

  • Newbie
  • Posts: 2
How can I ping an email address and get result?
« 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>

440bx

  • Hero Member
  • *****
  • Posts: 1198
Re: How can I ping an email address and get result?
« Reply #1 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/
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

jamie

  • Hero Member
  • *****
  • Posts: 2083
Re: How can I ping an email address and get result?
« Reply #2 on: August 07, 2019, 08:35:18 pm »
 :D
Number 1 at blue screen app creations!

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 675
    • Lebeau Software
Re: How can I ping an email address and get result?
« Reply #3 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/

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.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

440bx

  • Hero Member
  • *****
  • Posts: 1198
Re: How can I ping an email address and get result?
« Reply #4 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.

using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

jamie

  • Hero Member
  • *****
  • Posts: 2083
Re: How can I ping an email address and get result?
« Reply #5 on: August 08, 2019, 02:18:37 am »
and the connection is made!
Number 1 at blue screen app creations!

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 675
    • Lebeau Software
Re: How can I ping an email address and get result?
« Reply #6 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.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)

Thaddy

  • Hero Member
  • *****
  • Posts: 9178
Re: How can I ping an email address and get result?
« Reply #7 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.
« Last Edit: August 08, 2019, 07:31:24 am by Thaddy »
also related to equus asinus.

Thinus

  • Newbie
  • Posts: 2
Re: How can I ping an email address and get result?
« Reply #8 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!





Thaddy

  • Hero Member
  • *****
  • Posts: 9178
Re: How can I ping an email address and get result?
« Reply #9 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.
« Last Edit: August 08, 2019, 10:10:57 am by Thaddy »
also related to equus asinus.

trev

  • Full Member
  • ***
  • Posts: 220
  • Former Delphi 7 and Delphi 10.2 User
Re: How can I ping an email address and get result?
« Reply #10 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.
o Lazarus v2.1.0 r61775, FPC v3.3.1 r42640, macOS 10.14.6 (with sup update), Xcode 10.3
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.0 (Parallels VM)
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 18.04 (Parallels VM)

Thaddy

  • Hero Member
  • *****
  • Posts: 9178
Re: How can I ping an email address and get result?
« Reply #11 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.
« Last Edit: August 08, 2019, 02:32:29 pm by Thaddy »
also related to equus asinus.

Remy Lebeau

  • Hero Member
  • *****
  • Posts: 675
    • Lebeau Software
Re: How can I ping an email address and get result?
« Reply #12 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.
Remy Lebeau
Lebeau Software - Owner, Developer
Internet Direct (Indy) - Admin, Developer (Support forum)