469,303 Members | 2,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,303 developers. It's quick & easy.

Script to determine valid email address by querying server

Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..

Links/pointers ?

Mike

Jul 17 '05 #1
16 7850
Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..

Links/pointers ?

Mike


I don't think there is such a function/script.
Otherwise mail harvesters would have used it a long time ago.

If someone tries to access my domain and checks an email address I probably
would not reply...

Of course, I could be wrong.

Simon.
Jul 17 '05 #2
Such a function exist. I have seen it somewhere.
Some sites use this to check if the mail address is valid or not.
But as you said a mail server can always deny the request.
Guess most reply appropriately.
Arun

Jul 17 '05 #3

Arun wrote:
Such a function exist. I have seen it somewhere.
Some sites use this to check if the mail address is valid or not.
But as you said a mail server can always deny the request.
Guess most reply appropriately.
Arun


You may be talking about finger, which does this, but very few servers
are still running finger...it runs on TCP/IP port 79...to find out if a
particular server is running finger, type this at a unix/linux command
line:
telnet whatever.com 79
or type an IP address instead of whatever.com. But I doubt you will
find any servers that still run finger, for security reasons.

Jul 17 '05 #4
Such a function exist. I have seen it somewhere.
Some sites use this to check if the mail address is valid or not.
But as you said a mail server can always deny the request.
Guess most reply appropriately.
Arun


Are you sure you are not talking about a regex to check if a email address
is a _possible_ valid address?

Like check for at least one '@' and at least one '.' after the '@' and so
on?
That's the only ones I know of that would work.

Simon
Jul 17 '05 #5

"pdt256" <pd****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
http://www.regexlib.com/


Er..thanks but why the link?
I didn't ask for it.

Maybe you are confusing me for the op.

Simon
Jul 17 '05 #7
siliconmike wrote:
Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..

Links/pointers ?

Mike

http://joemarini.com/tutorials/tutor...mainexists.php
Jul 17 '05 #8
In theory, an SMTP server could respond to a RCPT TO request with a
error message if the account doesn't exist. I don't think that's how
most servers behave though.

Jul 17 '05 #9
siliconmike (si*********@yahoo.com) wrote:
: Hi, I'm looking for a reliable script that would connect to a host and
: somehow determine whether an email address is valid.

: since getmxrr() only gets the mx records..

: Links/pointers ?
There are routines to test if an address has the correct _syntax_ to be
potentially usable, so it is worth while to look for that. The routines
should be checking the syntax based on what RFC 822 says is valid, so
those are the kinds of terms you need for your search, but sorry, I have
no links for php. (Perl e.g. has Data::Validate::Email, and possibly
others).

As for confirming an address is actually in use by someone, unless you are
on a private lan and building a private, internal, application, then there
is no way to confirm the address is valid except by sending a confirmation
request to the address and asking them to respond.

In general you cannot assume any particular server will provide much
useful information when you contact them.

Invalid addresses are happily (well not happily) accepted by many servers
to prevent you learning what addresses are valid. Sometime all such
invalid addresses are even used as spam traps (i.e. if more than one mail
per day/week/hour to an invalid address then your ip is blocked or
bit-bucketted for a while).

Even valid addresses will, on some some systems, sometimes be forced to
cause an error after the data is received to prevent you learning they
were valid.

--

This space not for rent.
Jul 17 '05 #10


Malcolm Dew-Jones wrote:
siliconmike (si*********@yahoo.com) wrote:
: Hi, I'm looking for a reliable script that would connect to a host and
: somehow determine whether an email address is valid.

: since getmxrr() only gets the mx records..

: Links/pointers ?
There are routines to test if an address has the correct _syntax_ to be
potentially usable, so it is worth while to look for that. The routines
should be checking the syntax based on what RFC 822 says is valid, so
those are the kinds of terms you need for your search, but sorry, I have
no links for php. (Perl e.g. has Data::Validate::Email, and possibly
others).

As for confirming an address is actually in use by someone, unless you are
on a private lan and building a private, internal, application, then there
is no way to confirm the address is valid except by sending a confirmation
request to the address and asking them to respond.

In general you cannot assume any particular server will provide much
useful information when you contact them.

Invalid addresses are happily (well not happily) accepted by many servers
to prevent you learning what addresses are valid. Sometime all such
invalid addresses are even used as spam traps (i.e. if more than one mail
per day/week/hour to an invalid address then your ip is blocked or
bit-bucketted for a while).

Even valid addresses will, on some some systems, sometimes be forced to
cause an error after the data is received to prevent you learning they
were valid.


Oh ok.. well then another question is that whether I could rely on
getmxrr atleast to figure out whether the doman of the email address is
valid ? Is it a fully reliable means ?

Jul 17 '05 #11
>Oh ok.. well then another question is that whether I could rely on
getmxrr atleast to figure out whether the doman of the email address is
valid ? Is it a fully reliable means ?


If a domain has no MX record and it has no A record, a mail server
will not have any place to try to deliver it. In that sense, there
are no false negatives (the case of the domain registrar accidentally
taking down the domain because someone else's check bounced comes
under the heading of TRUE negative, at least for the short time
while the mess is straightened out, as real mail servers will fail
the mail also).

You can get TEMPORARY failures of DNS (timeouts on servers answering,
servers down, fiber cuts, servers not authoritative for stuff they
should be, etc.) but these errors can be distinguished from the
permanent errors (no such record here, final answer). I think PHP
lets you distinguish the errors.

Trying to send a bounce message, stopping short of sending a body,
can have plenty of false positives (server might not check name at
SMTP time), but there are enough true negatives (many of them DO
check) to make the check worth it beyond just checking the mx/a
records on the domain. You can also get "false" negatives: the
server accepts *NO* bounce messages period. I question whether you
want to accept mail from such a domain at all.

Gordon L. Burditt
Jul 17 '05 #12


Gordon Burditt wrote:
Oh ok.. well then another question is that whether I could rely on
getmxrr atleast to figure out whether the doman of the email address is
valid ? Is it a fully reliable means ?
If a domain has no MX record and it has no A record, a mail server
will not have any place to try to deliver it. In that sense, there
are no false negatives (the case of the domain registrar accidentally
taking down the domain because someone else's check bounced comes
under the heading of TRUE negative, at least for the short time
while the mess is straightened out, as real mail servers will fail
the mail also).


Well, then I can conclude that checking the existence of both MX and A
records and if none are found (no-such-records-here error) then to
invalidate the email address - is the way to go.

You can get TEMPORARY failures of DNS (timeouts on servers answering,
servers down, fiber cuts, servers not authoritative for stuff they
should be, etc.) but these errors can be distinguished from the
permanent errors (no such record here, final answer). I think PHP
lets you distinguish the errors.

Trying to send a bounce message, stopping short of sending a body,
can have plenty of false positives (server might not check name at
SMTP time), but there are enough true negatives (many of them DO
check) to make the check worth it beyond just checking the mx/a
records on the domain. You can also get "false" negatives: the
server accepts *NO* bounce messages period. I question whether you
want to accept mail from such a domain at all.

Gordon L. Burditt


Jul 17 '05 #13
I noticed that Message-ID:
<11**********************@g43g2000cwa.googlegroups .com> from siliconmike
contained the following:
Well, then I can conclude that checking the existence of both MX and A
records and if none are found (no-such-records-here error) then to
invalidate the email address - is the way to go.


It's all futile. The only valid email are ones which are read.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #14
Hello,

on 07/05/2005 08:25 AM siliconmike said the following:
Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..


This class does exactly what you ask:

http://www.phpclasses.org/emailvalidation
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #15
I bow down to your holy self.

Manuel Lemos wrote:
Hello,

on 07/05/2005 08:25 AM siliconmike said the following:
Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..


This class does exactly what you ask:

http://www.phpclasses.org/emailvalidation
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html


Jul 17 '05 #16
Your script works fine, except at certain times it shows the message
"connecting" on the browse and halts for 40-60 seconds, before fetching
the result.

Mike

siliconmike wrote:
I bow down to your holy self.

Manuel Lemos wrote:
Hello,

on 07/05/2005 08:25 AM siliconmike said the following:
Hi, I'm looking for a reliable script that would connect to a host and
somehow determine whether an email address is valid.

since getmxrr() only gets the mx records..


This class does exactly what you ask:

http://www.phpclasses.org/emailvalidation
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html


Jul 17 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Web Master | last post: by
reply views Thread by John Silver | last post: by
6 posts views Thread by S P Arif Sahari Wibowo | last post: by
5 posts views Thread by Martin Larsen | last post: by
4 posts views Thread by thanos | last post: by
4 posts views Thread by Ima Lozer | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.