Re: Check for valid email address

2004-10-01 Thread Randal L. Schwartz
 Gunnar == Gunnar Hjalmarsson [EMAIL PROTECTED] writes:

Gunnar Or: This is a function I'm using in a couple of programs to check the
Gunnar syntax, and that I believe is sufficient in practice:

Gunnar  sub emailsyntax {
Gunnar  return 1 unless
Gunnarmy ($localpart, $domain) = shift =~ /^(.+)@(.+)/;
Gunnar  my $char = '[^()@,;:\/\s\'|.]';
Gunnar  return 1 unless $localpart =~ /^$char+(?:\.$char+)*$/ or
Gunnar$localpart =~ /^[^,]+$/;
Gunnar  $domain =~ /^$char+(?:\.$char+)+$/ ? 0 : 1;
Gunnar  }

No, that incorrectly invalidates

fred[EMAIL PROTECTED]

which is a valid working address (try it!  it's an autoresponder).
Just use Email::Valid.  It has the right idea.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Check for valid email address

2004-10-01 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote:
Gunnar == Gunnar Hjalmarsson [EMAIL PROTECTED] writes:
Gunnar Or: This is a function I'm using in a couple of programs to check the
Gunnar syntax, and that I believe is sufficient in practice:
Gunnar  sub emailsyntax {
Gunnar  return 1 unless
Gunnarmy ($localpart, $domain) = shift =~ /^(.+)@(.+)/;
Gunnar  my $char = '[^()@,;:\/\s\'|.]';
Gunnar  return 1 unless $localpart =~ /^$char+(?:\.$char+)*$/ or
Gunnar$localpart =~ /^[^,]+$/;
Gunnar  $domain =~ /^$char+(?:\.$char+)+$/ ? 0 : 1;
Gunnar  }
No, that incorrectly invalidates
fred[EMAIL PROTECTED]
which is a valid working address
I never claimed the function to be perfect, and I said in practice. 
Noone is using such an address in real life unless they are asking for 
trouble; I'm sure you don't either.

Randal, you have that address only to demonstrate shortcomings in 
various attempts to check email syntaxes, right? ;-)

Just use Email::Valid.  It has the right idea.
I suggested that also, but the reason I don't use it in those two 
programs I mentioned is that the programs are publicly available for 
downloading, and I always think twice before making such programs 
dependent on non-standard modules.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Check for valid email address

2004-10-01 Thread Randal L. Schwartz
 Gunnar == Gunnar Hjalmarsson [EMAIL PROTECTED] writes:

Gunnar I never claimed the function to be perfect, and I said in
Gunnar practice. Noone is using such an address in real life unless they are
Gunnar asking for trouble; I'm sure you don't either.

A frequent poster of past to comp.lang.perl.misc, whom I've met
a few times when I was hanging out at NY.pm, uses the Email
address of [EMAIL PROTECTED].

I'm planning on shifting all stonehenge email addresses to something
with  in them soon, to prevent them from being scraped wherever they
appear.

So yes, you better darn well support 822, or you'll upset a lot more
than my toy user.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Check for valid email address

2004-09-30 Thread Denzil Kruse
Hi all,
 
I have a bunch of old email addresses in a database and would like to make sure they 
are deliverable before I try to send anything to them.  I don't need to find each and 
every bad one, just find most of them.  Or at least reduce the undeliverables to a 
more managable level.
 
I read through perlfaq9 and the Mail and Email modules.  It sounds like Mail::EXPN and 
Mail::SPF::Query depends upon the sender's host to make information available, which 
I'm assuming few do.  Mail::Verify and Mail::CheckUser seem pretty much the same and 
sound like the best option so far.  I haven't looked close at Email:Valid but if it's 
based upon Net stuff then it's tcp/ip based?  Don't want that, I don't think.
 
I'm just a little confused by all of the options above, and don't have any experience 
to see how well they actually work.  Does anyone have any ideas or just point me in 
the right direction?  I'm pretty new to the email world.
 
Thanks,
Denzil


-
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

Re: Check for valid email address

2004-09-30 Thread Gunnar Hjalmarsson
Denzil Kruse wrote:
I have a bunch of old email addresses in a database and would like
to make sure they are deliverable before I try to send anything to
them.
snip
Does anyone have any ideas or just point me in the right direction?
I'd say: Forget it. You can't find out whether an email address is
deliverable without asking the mail server of that address, i.e.
trying to send a message. What you can do is testing if the
domain/host has an MX record. And you can of course test the syntax,
but that's it.
Why don't you just send a message and ask the recipients to confirm
that they are still reading their messages to respective address?
Because you are not going to send any unsolicited crap anyway, right?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Check for valid email address

2004-09-30 Thread Denzil Kruse


Gunnar Hjalmarsson [EMAIL PROTECTED] wrote:

I'd say: Forget it. You can't find out whether 
an email address is deliverable without asking
the mail server of that address, i.e.
trying to send a message. What you can do is 
testing if the domain/host has an MX record. 
And you can of course test the syntax, but 
that's it.

Okay, that sounds like Mail::Verify then.

Why don't you just send a message and ask the
recipients to confirm that they are still reading
their messages to respective address?

That's what we started doing, and about 60% of them
are undeliverable.

Because you are not going to send any unsolicited
crap anyway, right?

No, it's an old program that has been in limbo for a
while and we wanted to contact the people that are
still signed up and let them know it is out of limbo.

Thanks for the help, I'll probabaly give the Verify a
try then.

Denzil











__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Check for valid email address

2004-09-30 Thread Gunnar Hjalmarsson
Denzil Kruse wrote:
Gunnar Hjalmarsson wrote:
What you can do is testing if the domain/host has an MX record.
And you can of course test the syntax, but that's it.
Okay, that sounds like Mail::Verify then.
I had a look at the source of Mail::Verify, and even if the module
claims to verify the syntax, it doesn't really. You may want to check
out e.g. Email::Valid, too.
Or: This is a function I'm using in a couple of programs to check the
syntax, and that I believe is sufficient in practice:
sub emailsyntax {
return 1 unless
  my ($localpart, $domain) = shift =~ /^(.+)@(.+)/;
my $char = '[^()@,;:\/\s\'|.]';
return 1 unless $localpart =~ /^$char+(?:\.$char+)*$/ or
  $localpart =~ /^[^,]+$/;
$domain =~ /^$char+(?:\.$char+)+$/ ? 0 : 1;
}
OTOH, since you know that the addresses were valid once, the syntax
check may not be your first priority.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Check for valid email address

2004-09-30 Thread Sano Babu
On Thu, 30 Sep 2004 23:58:34 +0200, Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote:
 Denzil Kruse wrote:
  Gunnar Hjalmarsson wrote:
  What you can do is testing if the domain/host has an MX record.
  And you can of course test the syntax, but that's it.
 
  Okay, that sounds like Mail::Verify then.
 
 I had a look at the source of Mail::Verify, and even if the module
 claims to verify the syntax, it doesn't really. You may want to check
 out e.g. Email::Valid, too.

Gunnar let me ask u a question.. :) DO u ever sleep?? U're constantly
helping people out here... It seems u never step back from helping :)
anyway thats good. and personally i've not had a chance to ask u
questions in Perl in this list as i am still pretty much a learner,
let me take a break n say thanks :-) (OK thats not much or is it?)..
Its really nice to have people around for support while learning. :-)

[snip]
 
 
 --
 Gunnar Hjalmarsson
 Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
[snip]

-- 
Cheers,
SanoBabu

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Check for valid email address

2004-09-30 Thread Gunnar Hjalmarsson
Sano Babu wrote:
Gunnar let me ask u a question.. :) DO u ever sleep??
Yeah, it happens. :)
U're constantly helping people out here... It seems u never step
back from helping :)
Well, I'm not alone, right? Actually, there are people for whom that
is more true than it is for me, and who have been around much longer
than me.
anyway thats good. and personally i've not had a chance to ask u
questions in Perl in this list as i am still pretty much a learner,
let me take a break n say thanks :-)
You're welcome. And let that be a thanks to everyone who are answering
questions here.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Check for valid email address

2004-09-30 Thread Denzil Kruse

--- Gunnar Hjalmarsson [EMAIL PROTECTED] wrote:

 I had a look at the source of Mail::Verify, and even
 if the module
 claims to verify the syntax, it doesn't really. You
 may want to check
 out e.g. Email::Valid, too.

I already know the email is works because we've sent
them before, so I'll just use the Verify.  That's good
to know that I need to check the address with another
function.   I wouldn't have looked at the internals of
the module.

Thanks for your help!

And BTW, I usually snip most of the history of the
email threads just to keep it clean.  I don't know
what the etiquette is on this list.  Do people like to
see the whole conversation?

Denzil



__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Check for valid email address

2004-09-30 Thread Gunnar Hjalmarsson
Denzil Kruse wrote:
I usually snip most of the history of the email threads just to
keep it clean.
Sounds as common sense to me, and it's probably part of the general
'netiquette' to only quote what's needed to give context.
I don't know what the etiquette is on this list.  Do people like to
see the whole conversation?
I for one agree with you.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Check for valid email address

2004-09-30 Thread Chris Devers
On Thu, 30 Sep 2004, Denzil Kruse wrote:

 And BTW, I usually snip most of the history of the
 email threads just to keep it clean.  I don't know
 what the etiquette is on this list.  Do people like to
 see the whole conversation?

No!

Strip messages down to the essentials of what you're replying to; if 
that isn't enough context for people to figure out what you're writing 
about, there's always the web archives to turn to for background info.

You're absolutely doing the right thing here :-)


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response