This is a discussion on Quick email address check within the PHP General forums, part of the PHP Programming Forums category; I'm scripting a simple registry where the user can input their name and email address. I'd like to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm scripting a simple registry where the user can input their name and email address.
I'd like to do a quick validity check on the email address they just inputted. I can check the syntax, etc. but want check if the address exists. I realize that servers can take a long time to bounce etc. I'll just deal with this separately. Is there a better way than simply sending a test email to see if it bounces? Thanks.... |
|
|||
|
On Wed, Mar 26, 2008 at 1:28 PM, Al <news@ridersite.org> wrote:
> I'm scripting a simple registry where the user can input their name and email address. > > I'd like to do a quick validity check on the email address they just inputted. I can check the > syntax, etc. but want check if the address exists. I realize that servers can take a long time to > bounce etc. I'll just deal with this separately. > > Is there a better way than simply sending a test email to see if it bounces? > > Thanks.... > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > You could use PEAR Validate::email() with the hostname lookup. It isn't exactly what you're asking for but I use it a lot with fairly good success. |
|
|||
|
On Wed, March 26, 2008 12:28 pm, Al wrote:
> Is there a better way than simply sending a test email to see if it > bounces? Yes. Force the user to click on a link to prove that they actually CHECK that email address. Just because it doesn't bounce doesn't mean it's a valid email address. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? |
|
|||
|
Al wrote:
> I'm scripting a simple registry where the user can input their name > and email address. > > I'd like to do a quick validity check on the email address they just > inputted. I can check the syntax, etc. but want check if the address > exists. I realize that servers can take a long time to bounce etc. > I'll just deal with this separately. > Is there a better way than simply sending a test email to see if it > bounces? Do an MX lookup on the domain, maybe attempt a brief connection to it. /Per Jessen, Zürich |
|
|||
|
Al wrote:
> I'm scripting a simple registry where the user can input their name and > email address. > > I'd like to do a quick validity check on the email address they just > inputted. I can check the syntax, etc. but want check if the address > exists. I realize that servers can take a long time to bounce etc. I'll > just deal with this separately. > > Is there a better way than simply sending a test email to see if it > bounces? > > Thanks.... There may be a SMTP class to help you do it, or you can do it manually but here is a quick process. Look up the MX for thedomain.com. maybe use checkdnsrr(). If not found then it is bad, if found connect and issue the following SMTP commands: MAIL FROM: me@example.com 250 ok RCPT TO: nonexistant@thedomain.com 550 sorry, no mailbox here by that name. (#5.7.17) Optimally you want to see: 250 ok You could also see: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) This would mean that there is an MX record for thedomain.com pointing to this server but this server isn't configured to accept mail for this domain. -Shawn |
|
|||
|
All good suggestions guys. Richard's has the advantage of solving the potential for a delay by the
user's email server. I'll have the user submit and tell'm to wait while I check the email address for them. Solves several problems. Al wrote: > I'm scripting a simple registry where the user can input their name and > email address. > > I'd like to do a quick validity check on the email address they just > inputted. I can check the syntax, etc. but want check if the address > exists. I realize that servers can take a long time to bounce etc. I'll > just deal with this separately. > > Is there a better way than simply sending a test email to see if it > bounces? > > Thanks.... |
|
|||
|
Hello,
on 03/26/2008 02:28 PM Al said the following: > I'm scripting a simple registry where the user can input their name and > email address. > > I'd like to do a quick validity check on the email address they just > inputted. I can check the syntax, etc. but want check if the address > exists. I realize that servers can take a long time to bounce etc. I'll > just deal with this separately. > > Is there a better way than simply sending a test email to see if it > bounces? You may want to try this E-mail validation PHP class that does just that. It simulates an attempt to send a message to the SMTP server of the e-mail domain. It does not finish to send the message. The message could still bounce later, but at least you will still detect some invalid addresses. http://www.phpclasses.org/emailvalidation -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ |
|
|||
|
Can anyone recommend anything that would be good to use on an existing
mailing list that is a few years old and didn't have any bounce handling? On 27/03/2008, Manuel Lemos <mlemos@acm.org> wrote: > > Hello, > > on 03/26/2008 02:28 PM Al said the following: > > I'm scripting a simple registry where the user can input their name and > > email address. > > > > I'd like to do a quick validity check on the email address they just > > inputted. I can check the syntax, etc. but want check if the address > > exists. I realize that servers can take a long time to bounce etc. I'll > > just deal with this separately. > > > > Is there a better way than simply sending a test email to see if it > > bounces? > > You may want to try this E-mail validation PHP class that does just > that. It simulates an attempt to send a message to the SMTP server of > the e-mail domain. It does not finish to send the message. The message > could still bounce later, but at least you will still detect some > invalid addresses. > > http://www.phpclasses.org/emailvalidation > > > -- > > Regards, > Manuel Lemos > > PHP professionals looking for PHP jobs > http://www.phpclasses.org/professionals/ > > PHP Classes - Free ready to use OOP components written in PHP > http://www.phpclasses.org/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
|||
|
> All good suggestions guys. Richard's has the advantage of solving the
> potential for a delay by the user's email server. > > I'll have the user submit and tell'm to wait while I check the email > address for them. Solves several problems. > > Al wrote: >> I'm scripting a simple registry where the user can input their name >> and email address. >> >> I'd like to do a quick validity check on the email address they just >> inputted. I can check the syntax, etc. but want check if the address >> exists. I realize that servers can take a long time to bounce etc. >> I'll just deal with this separately. >> >> Is there a better way than simply sending a test email to see if it >> bounces? The Mail/RFC822 class in PEAR has a quick(er) static method for checking the format of an Interweb email address. Mail_RFC822::isValidInetAddress() IIRC -- Richard Heyes Employ me: http://www.phpguru.org/cv |
|
|||
|
At 1:28 PM -0400 3/26/08, Al wrote:
>I'm scripting a simple registry where the user can input their name >and email address. > >I'd like to do a quick validity check on the email address they just >inputted. I can check the syntax, etc. but want check if the address >exists. I realize that servers can take a long time to bounce etc. >I'll just deal with this separately. > >Is there a better way than simply sending a test email to see if it bounces? > >Thanks.... I've had pretty good success from the following: after checking the syntax (exactly one @, at least one . to the right of the @, etc.), if it passes the syntax check, I then set $rhs to everything to the right of the @. Then I test: if (!checkdnsrr($rhs, 'MX')) { invalid } else { valid } -----===== Bill =====----- -- You can't tell which way the train went by looking at the track. |