Re: Email Id Verification

2012-05-25 Thread Grant Edwards
On 2012-05-25, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
 On Thu, 24 May 2012 05:32:16 -0700, niks wrote:

 Hello everyone..
 I am new to asp.net...
 I want to use Regular Expression validator in Email id verification..

 Why do you want to write buggy code that makes your users hate your 
 program? Don't do it! Write good code, useful code! Validating email 
 addresses is the wrong thing to do.

I have to agree with Steven.  Nothing will make your users swear at
you as certainly as when you refuse to accept the e-mail address at
which the reeive e-mail all day every day.

-- 
Grant Edwards   grant.b.edwardsYow! I appoint you
  at   ambassador to Fantasy
  gmail.comIsland!!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Peter Pearson
On Fri, 25 May 2012 13:36:18 + (UTC), Grant Edwards wrote:
[snip]
 . . .  Nothing will make your users swear at
 you as certainly as when you refuse to accept the e-mail address at
 which the reeive e-mail all day every day.

Amusingly, every time I log into Discovercard's web site, I
get a red-letter warning that my registered email address is
invalid.  Inquiring, I was told that the presence of the
substring spam anywhere in the address (including
@spamcop.net) makes the address invalid in Discovercard's
opinion.

-- 
To email me, substitute nowhere-spamcop, invalid-net.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Chris Angelico
On Sat, May 26, 2012 at 2:25 AM, Peter Pearson ppearson@nowhere.invalid wrote:
 Amusingly, every time I log into Discovercard's web site, I
 get a red-letter warning that my registered email address is
 invalid.  Inquiring, I was told that the presence of the
 substring spam anywhere in the address (including
 @spamcop.net) makes the address invalid in Discovercard's
 opinion.

I had no idea it was so easy to prevent spam from getting through. I
am in awe, Discovercard!

Yet, invalid or not, it apparently works for you?

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Ian Kelly
On Fri, May 25, 2012 at 10:33 AM, Chris Angelico ros...@gmail.com wrote:
 On Sat, May 26, 2012 at 2:25 AM, Peter Pearson ppearson@nowhere.invalid 
 wrote:
 Amusingly, every time I log into Discovercard's web site, I
 get a red-letter warning that my registered email address is
 invalid.  Inquiring, I was told that the presence of the
 substring spam anywhere in the address (including
 @spamcop.net) makes the address invalid in Discovercard's
 opinion.

 I had no idea it was so easy to prevent spam from getting through. I
 am in awe, Discovercard!

I would think that it is not an anti-spam measure, but simply due to
the fact that most addresses containing spam tend to be something
like nos...@invalid.net, being either a fake address or a junk inbox
that is only checked when an important mail is expected.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Chris Angelico
On Sat, May 26, 2012 at 3:04 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
 I would think that it is not an anti-spam measure, but simply due to
 the fact that most addresses containing spam tend to be something
 like nos...@invalid.net, being either a fake address or a junk inbox
 that is only checked when an important mail is expected.

If it's fake, you'll find out when you send to it. If it's checked
only when important mail is expected, you accept it. I'm not seeing a
problem here. I have a @yahoo.com.au address that is used solely in
the latter form; it's checked maybe once or twice a month (in
comparison to my two primary accounts, which both alert me on incoming
mail, one of them in direct response to the SMTP server receiving it);
and if any form rejects it, that's flat wrong.

DNS lookups aren't particularly expensive. A check for whether the
domain has an MX record will catch most forms of fakery without
needing any extra effort.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Cameron Simpson
On 25May2012 13:36, Grant Edwards invalid@invalid.invalid wrote:
| On 2012-05-25, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
|  On Thu, 24 May 2012 05:32:16 -0700, niks wrote:
|  Hello everyone..
|  I am new to asp.net...
|  I want to use Regular Expression validator in Email id verification..
| 
|  Why do you want to write buggy code that makes your users hate your 
|  program? Don't do it! Write good code, useful code! Validating email 
|  addresses is the wrong thing to do.
| 
| I have to agree with Steven.  Nothing will make your users swear at
| you as certainly as when you refuse to accept the e-mail address at
| which the reeive e-mail all day every day.

And it will get better. If the validation code is sufficiently
widespread, the user may be unable to complain or report the issue.
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Don't have awk? Use this simple sh emulation:
#!/bin/sh
echo 'Awk bailing out!' 2
exit 2
- Tom Horsley tahors...@csd.harris.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-25 Thread Jon Clements
On Friday, 25 May 2012 14:36:18 UTC+1, Grant Edwards  wrote:
 On 2012-05-25, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
  On Thu, 24 May 2012 05:32:16 -0700, niks wrote:
 
  Hello everyone..
  I am new to asp.net...
  I want to use Regular Expression validator in Email id verification..
 
  Why do you want to write buggy code that makes your users hate your 
  program? Don't do it! Write good code, useful code! Validating email 
  addresses is the wrong thing to do.
 
 I have to agree with Steven.  Nothing will make your users swear at
 you as certainly as when you refuse to accept the e-mail address at
 which the reeive e-mail all day every day.
 
 -- 
 Grant Edwards   grant.b.edwardsYow! I appoint you
   at   ambassador to Fantasy
   gmail.comIsland!!!

Ditto.

This would be my public email, but (like most I believe) also have 'private' 
and work email addresses. 

For the OP, just trying to check an email is syntactically correct is okay-ish 
if done properly. Normally as mentioned you just send a confirmation email to 
said address with some id and link that confirms (normally with an expiry 
period). Some mail servers support the does this mailbox exist? request, but 
I fear these days due to spam, most will just say no -- so the only option is 
to send and handle a bounce (and some don't even send back bounces). And a 
pretty good way for malicious people to make mail servers think you're trying a 
DoS.

Although, what I'm finding useful is an option of auth'ing with twitter, 
facebook, google etc... Doesn't require a huge amount of work, and adds a bit 
of validity to the request.

Jon (who still didn't get any bloody Olympic tickets).
-- 
http://mail.python.org/mailman/listinfo/python-list


Email Id Verification

2012-05-24 Thread niks
Hello everyone..
I am new to asp.net...
I want to use Regular Expression validator in Email id verification..
Can anyone tell me how to use this and what is the meaning of
this
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Chris Angelico
On Thu, May 24, 2012 at 10:32 PM, niks nikunjparmar...@gmail.com wrote:
 Hello everyone..
 I am new to asp.net...
 I want to use Regular Expression validator in Email id verification..
 Can anyone tell me how to use this and what is the meaning of
 this
 \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

This is a mailing list about Python, not ASP, and not regular
expressions. Every regex library is different, some more than others,
so your best bet is to find documentation on the actual
function/library you'll be using.

But I would strongly recommend NOT using a regex to validate an email
address. It's prone to false positives and false negatives. There are,
unfortunately, many systems around which do not accept legal addresses
(for instance, this.is.vali...@rosuav.com is, as the name suggests,
quite valid - as is fred_foobar@[203.214.67.43]); part of the blame
can be laid on PHP's inbuilt validation functions, but I know that
several are implemented using a fairly simple and brutally wrong
check.

Validate the domain part (the bit after the @) with a DNS lookup,
nothing more and nothing less. If you absolutely must do a
syntactic/charset check, read the appropriate RFCs and figure out what
really is and isn't legal. You will be surprised. (For instance,
foo@localhost is a perfectly valid address, because localhost is a
top-level domain.)

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread alister
On Thu, 24 May 2012 05:32:16 -0700, niks wrote:

 Hello everyone..
 I am new to asp.net...
 I want to use Regular Expression validator in Email id verification..
 Can anyone tell me how to use this and what is the meaning of this
 \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

this is not really a python question.

I would suggest you locate a good regular expression tutorial  then try 
to break it down
otherwise you could try asking in an asp.net forum




-- 
Sometimes when presented with a problem you will think I know I will use 
regular expressions Now you have two problems.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Chris Angelico
On Thu, May 24, 2012 at 11:45 PM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
        And maybe follow-up with a review of this monster:
 http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html

That is awesome. Epic. Eyeball-bleeding.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread John Nagle

On 5/24/2012 5:32 AM, niks wrote:

Hello everyone..
I am new to asp.net...
I want to use Regular Expression validator in Email id verification..
Can anyone tell me how to use this and what is the meaning of
this
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*


   Not a Python question.

   It matches anything that looks like a mail user name followed by
an @ followed by anything that looks more or less like a domain name.
The domain name must contain at least one ., and cannot end with
a ., which is not strictly correct but usually works.

John Nagle
--
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Ben Finney
John Nagle na...@animats.com writes:

It matches anything that looks like a mail user name followed by
 an @ followed by anything that looks more or less like a domain name.
 The domain name must contain at least one ., and cannot end with
 a ., which is not strictly correct but usually works.

It will reject many valid email addresses.

For better guidance on verifying email address values, see the official
recommendations in RFC 3696 URL:https://tools.ietf.org/html/rfc3696.

In short: don't bother validating email addresses, the email system is
best placed to do that. Just try using them and catch the failures when
they happen.

-- 
 \   “He was the mildest-mannered man / That ever scuttled ship or |
  `\   cut a throat.” —“Lord” George Gordon Noel Byron, _Don Juan_ |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Cameron Simpson
On 25May2012 01:20, Chris Angelico ros...@gmail.com wrote:
| On Thu, May 24, 2012 at 11:45 PM, Dennis Lee Bieber
| wlfr...@ix.netcom.com wrote:
|         And maybe follow-up with a review of this monster:
|  http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
| 
| That is awesome. Epic. Eyeball-bleeding.

+1 !!

I hope someone's validated that regexp before using it to validate email
addresses:-) I'm amazed. (And amazed that the sheer code smell doesn't
drive the author away from suggesting it.)

The mere presence of nesting comments in RFC2822 addresses prevents
using a single regexp to parse them.
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

It's state-of-the-art But it doesn't work! That is the state-of-the-art.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Cameron Simpson
On 24May2012 05:32, niks nikunjparmar...@gmail.com wrote:
| Hello everyone..
| I am new to asp.net...

Time to run away fast before you're commited then:-)
You're aware this is a _python_ list/group, yes?

| I want to use Regular Expression validator in Email id verification..

You can't. Valid addresses including nesting comments. Regexps don't do
recursion.

| Can anyone tell me how to use this and what is the meaning of
| this
| \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

If you don't understand it, DON'T use it. And in any case, it is
simplistic (== wrong). As pointed out by others in this thread.
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Men are four:
He who knows and knows that he knows; he is wise, follow him.
He who knows and knows not that he knows; he is asleep, wake him.
He who knows not and knows that he knows not; he is ignorant, teach him.
He who knows not and knows not that he knows not; he is a fool, spurn him!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Chris Angelico
On Fri, May 25, 2012 at 9:03 AM, Cameron Simpson c...@zip.com.au wrote:
 On 24May2012 05:32, niks nikunjparmar...@gmail.com wrote:
 | Hello everyone..
 | I am new to asp.net...

 Time to run away fast before you're commited then:-)
 You're aware this is a _python_ list/group, yes?

Committed to an asylum or to source control?

Python is an asylum. Ruled by a Benevolent Inmate For Life. And yes,
it's a life sentence.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Steven D'Aprano
On Thu, 24 May 2012 05:32:16 -0700, niks wrote:

 Hello everyone..
 I am new to asp.net...
 I want to use Regular Expression validator in Email id verification..

Why do you want to write buggy code that makes your users hate your 
program? Don't do it! Write good code, useful code! Validating email 
addresses is the wrong thing to do.

The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO 
IT. That is all. Just because an address is syntactically valid doesn't 
mean it is deliverable.

You can't validate postal addresses. How would you even try? Even if you 
could, you wouldn't use a regex for it. That's the post office's job to 
decide whether mail can be delivered, not yours. Who are you to say that 
some address in Russia or Bolivia or Kuwait is invalid?

Email addresses are no different. It is the job of the mail server to 
decide whether email can be delivered, not yours.

http://northernplanets.blogspot.com.au/2007/03/how-not-to-validate-email-addresses.html

http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx

http://haacked.com/archive/2007/08/26/dont-be-a-validation-nazi.aspx


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread MRAB

On 25/05/2012 00:03, Cameron Simpson wrote:

On 24May2012 05:32, niksnikunjparmar...@gmail.com  wrote:
| Hello everyone..
| I am new to asp.net...

Time to run away fast before you're commited then:-)
You're aware this is a _python_ list/group, yes?

| I want to use Regular Expression validator in Email id verification..

You can't. Valid addresses including nesting comments. Regexps don't do
recursion.


Some regex implementations _can_ do recursion.


| Can anyone tell me how to use this and what is the meaning of
| this
| \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

If you don't understand it, DON'T use it. And in any case, it is
simplistic (== wrong). As pointed out by others in this thread.


True, it's the wrong tool for the job.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Paul Rubin
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
 Why do you want to write buggy code that makes your users hate your 
 program? ...
 The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO 
 IT. 

Of course spamming people will make them hate you even more.  Insisting
that people give you a valid email address (unless you have a
demonstrably legitimate use for it) is a variant of that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Steven D'Aprano
On Thu, 24 May 2012 18:35:21 -0700, Paul Rubin wrote:

 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
 Why do you want to write buggy code that makes your users hate your
 program? ...
 The only way to validate an email address is to ACTUALLY SEND AN EMAIL
 TO IT.
 
 Of course spamming people will make them hate you even more.  Insisting
 that people give you a valid email address (unless you have a
 demonstrably legitimate use for it) is a variant of that.

Ha, of course. I assumed that the OP actually has a valid reason for 
requesting an email address from the user.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Chris Angelico
On Fri, May 25, 2012 at 11:35 AM, Paul Rubin no.email@nospam.invalid wrote:
 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
 Why do you want to write buggy code that makes your users hate your
 program? ...
 The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO
 IT.

 Of course spamming people will make them hate you even more.  Insisting
 that people give you a valid email address (unless you have a
 demonstrably legitimate use for it) is a variant of that.

But why do you want to validate the email address? That's the
question. Usually it's because you're going to be sending emails to
that address, in which case you not only want to ensure that it's a
real address, you want to ensure that the person who keyed it in is
legitimately allowed to do so - the usual implementation of that being
please check your emails for the confirmation code.

There are, however, ways of not-quite-sending an email. For instance,
you can connect to the domain's MX, give your HELO, MAIL FROM, and
RCPT TO commands, and then quit before sending any DATA. That won't
give a 100% guarantee, but it'll certainly tell you about a lot of
failures (most of them in that first megastep of looking up the domain
in DNS to find its MX record, and then attempting a connection).

Now, if your goal is to recognize email addresses in plain text (eg to
make them clickable), then you probably don't want true validation -
you want more of a DWIM setup where common tails aren't included
[for instance, an email address followed by a close bracket, like
f...@bar.com]. That's completely different.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Ben Finney
Paul Rubin no.email@nospam.invalid writes:

 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
  Why do you want to write buggy code that makes your users hate your 
  program? ...
  The only way to validate an email address is to ACTUALLY SEND AN EMAIL TO 
  IT. 

 Of course spamming people will make them hate you even more.

Use the email address without spamming, then.

The point is that, having collected the email address, it's useless
unless one actually uses it *as an email address*, by sending a message
to it. Before then, “validating” it tells you nothing.

 Insisting that people give you a valid email address (unless you have
 a demonstrably legitimate use for it) is a variant of that.

And matching it against a regex is going to either get it wrong
(rejecting many valid email addresses), or be useless (accepting just
about anything as “valid”).

The test which matters is to use the value as an email address, by
sending a message when the time comes to do that.

-- 
 \ “It's my belief we developed language because of our deep inner |
  `\  need to complain.” —Jane Wagner, via Lily Tomlin |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Email Id Verification

2012-05-24 Thread Paul Rubin
Ben Finney ben+pyt...@benfinney.id.au writes:
 The point is that, having collected the email address, it's useless
 unless one actually uses it *as an email address*, by sending a message
 to it. Before then, “validating” it tells you nothing.

Right, the only legitimate use of an email address is sending legitimate
email to it.  An example might be collecting an address so that service
staff can respond to a help request.  If there is not an up-front, good
reason to want to email the address, then collecting it is not
legitimate.  An example is web sites where users have to supply
addresses to register.  This is why mailinator.com was invented, but
it's annoying even if you use mailinator.
-- 
http://mail.python.org/mailman/listinfo/python-list