Professional Web Applications Themes

Check for valid email address - PERL Beginners

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 ...

  1. #1

    Default Check for valid email address

    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!
    Denzil Guest

  2. #2

    Default Re: Check for valid email address

    Denzil Kruse wrote: 

    <snip>
     

    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
    Gunnar Guest

  3. #3

    Default Re: Check for valid email address



    Gunnar Hjalmarsson <cc> wrote:
     

    Okay, that sounds like Mail::Verify then.
     

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

    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./new_mail
    Denzil Guest

  4. #4

    Default Re: Check for valid email address

    Denzil Kruse wrote: 
    >
    > Okay, that sounds like Mail::Verify then.[/ref]

    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
    Gunnar Guest

  5. #5

    Default Re: Check for valid email address

    On Thu, 30 Sep 2004 23:58:34 +0200, Gunnar Hjalmarsson
    <cc> wrote: 
    > >
    > > Okay, that sounds like Mail::Verify then.[/ref]
    >
    > 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.[/ref]

    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] 
    [snip]

    --
    Cheers,
    SanoBabu
    Sano Guest

  6. #6

    Default Re: Check for valid email address

    Sano Babu wrote: 

    Yeah, it happens. :)
     

    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.
     

    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
    Gunnar Guest

  7. #7

    Default Re: Check for valid email address


    --- Gunnar Hjalmarsson <cc> wrote:
     

    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./new_mail
    Denzil Guest

  8. #8

    Default Re: Check for valid email address

    Denzil Kruse wrote: 

    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 for one agree with you.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Guest

  9. #9

    Default Re: Check for valid email address

    On Thu, 30 Sep 2004, Denzil Kruse wrote:
     

    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
    Chris Guest

  10. #10

    Default Re: Check for valid email address

    >>>>> "Gunnar" == Gunnar Hjalmarsson <cc> 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
    Gunnar> my ($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&com

    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
    <com> <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!
    Randal Guest

  11. #11

    Default Re: Check for valid email address

    Randal L. Schwartz wrote: [/ref]
    >
    > 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
    > Gunnar> my ($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&com
    >
    > which is a valid working address[/ref]

    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? ;-)
     

    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
    Gunnar Guest

  12. #12

    Default Re: Check for valid email address

    >>>>> "Gunnar" == Gunnar Hjalmarsson <cc> 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 <*qz.to>.

    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
    <com> <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!
    Randal Guest

  13. #13

    Default How TO CREATE RUNTIME CONTROLS

    Hi All,
    I want to create runtime controls on the same webpage.
    For example,
    my webpage will contain a textbox, a hyperlink & a
    submit button.
    I want to achieve the following functionality :
    That is, if i click on the hyperlink, a new textboxes
    should be placed below the first one, if i click the
    second time on the hyperlink, another new textbox will
    be appended/placed below the 2nd one...and so on...
    Then on submit button, a new page is called where the
    data will be displaced which the user enters.

    kindly help me,
    thanks in advance,
    atul.



    _______________________________
    Do you Yahoo!?
    Declare Yourself - Register online to vote today!
    http://vote.
    Atul Guest

Similar Threads

  1. Email address syntax check?
    By tuxedo in forum PERL Modules
    Replies: 8
    Last Post: December 2nd, 10:38 PM
  2. Is there a way to check for valid date?
    By bob in forum PHP Development
    Replies: 3
    Last Post: June 10th, 11:50 PM
  3. CDOSYS - IF NOT A VALID EMAIL
    By jsteinmann in forum Dreamweaver AppDev
    Replies: 5
    Last Post: February 28th, 04:47 PM
  4. Email::Valid cannot find itself when doing a make test.
    By Robert Nicholson in forum PERL Modules
    Replies: 2
    Last Post: October 1st, 08:25 AM
  5. Please help : Checking for valid email addresses
    By mrichmond in forum Macromedia Dreamweaver
    Replies: 5
    Last Post: August 5th, 09:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139