Professional Web Applications Themes

newbie problem with Mail::POP3Client; - PERL Beginners

I'm sure you've seen this one hundreds of times! I copied the following script, downloaded and installed the POP3Client module but it doesn't want to connect to an external POP3 server for me, for some reason. I have put in the correct pop3 server, username and password, at least the same ones that work for me and will connect Mozilla. Any thoughts about how to find the problem and/or debug? It runs, but I get "You have -1 messages" I suspect the -1 means the variable has not been initialized or for some reason it will not connect to the ...

  1. #1

    Default newbie problem with Mail::POP3Client;

    I'm sure you've seen this one hundreds of times!

    I copied the following script, downloaded and installed the POP3Client
    module but it doesn't want to connect to an external POP3 server for me,
    for some reason. I have put in the correct pop3 server, username and
    password, at least the same ones that work for me and will connect Mozilla.

    Any thoughts about how to find the problem and/or debug?

    It runs, but I get "You have -1 messages"

    I suspect the -1 means the variable has not been initialized or for some
    reason it will not connect to the server.

    TIA

    Jim

    #!/usr/bin/perl

    use strict;
    use Mail::POP3Client;

    my($pop, $num_mesg, $i);

    $pop = new Mail::POP3Client( USER => "username",
    PASSWORD => "password",
    HOST => "www.host.name" );

    $num_mesg = $pop->Count; #How many messages are there?
    print ("You have ".$num_mesg." new messages.\n");

    for ($i = 1; $i <= $num_mesg; $i++) {
    print $pop->Head($i), "\n"; #print header for each message
    }
    Jim Guest

  2. #2

    Default Re: newbie problem with Mail::POP3Client;

    > I'm sure you've seen this one hundreds of times! 

    Uh, nope. Which is really nice.
     
    Mozilla. 

    Did you turn on the DEBUG switch? There is a section in the docs that
    state that it will give an indication of errors. I copied your script,
    turned it on, saw that the connection was successful by login was not. I
    then attempted switching the AUTH_MODE for my connection to PASS (yes I
    know what this means, do you? If not, learn before doing so.) and
    everything then worked.
     

    The docs state that currently the only way to check for successful
    connection is to ask for the number of messages, with -1 indicating
    connection failure. I suspect 0 is success but empty, and >1 meaning
    success and with messages.

    Granted this is fairly annoying and I would think getting that switched
    is high on their list.
     

    -1 is initialization of the variable, just not a connection.
     

    <snip code>

    http://danconia.org
    Wiggins Guest

  3. #3

    Default Re: newbie problem with Mail::POP3Client;

    Thanks for this. I'm not completely new but haven't found any sort of
    comprehensive docs, only cryptic ones. Where might I find it?

    By debug switch do you mean the optional debug_flag ? No I haven't but
    about to.

    No idea what AUTH_MODE means, and my two oreilly perl books don't tell
    me either but I'll try and Google for it.

    Thanks, have moved on a little!

    Jim
     
    >
    >The docs state that currently the only way to check for successful
    >connection is to ask for the number of messages, with -1 indicating
    >connection failure. I suspect 0 is success but empty, and >1 meaning
    >success and with messages.
    >
    >Granted this is fairly annoying and I would think getting that switched
    >is high on their list.
    >
    >

    >
    >-1 is initialization of the variable, just not a connection.
    >
    >

    >
    ><snip code>
    >
    >http://danconia.org
    >
    >
    >[/ref]

    --


    ==============================================
    Jim Maas Ph.D.
    29 Amber Close
    Earley, Reading, UK
    RG6 7ED

    0118-935-3283
    0771-985-8698
    jamaas at btinternet dot com


    Jim Guest

  4. #4

    Default Re: newbie problem with Mail::POP3Client;

    Please bottom post....
     

    Doentation for modules available on CPAN are always available online
    in a quite readable format, for example,

    http://search.cpan.org/~sdowd/Mail-POP3Client-2.16/POP3Client.pm

    Also you can access most modules doentation after installation by
    issuing,

    perldoc <module name>
    perldoc Mail::POP3Client
     

    Well yes, but it is 'DEBUG', and is passed to the constructor.
     

    AUTH_MODE sets the mode that the POP client will use to send the
    password. The POP3 server on the other end may or may not support
    "encrypted" (actually hashed but that's another topic) passwords in
    which case the AUTH_MODE may need to be set to tell the client to send
    the password in clear text. Setting AUTH_MODE to BEST seems to allow
    the most flexibility.
     

    No problem.

    http://danconia.org
     
    > >
    > >The docs state that currently the only way to check for successful
    > >connection is to ask for the number of messages, with -1 indicating
    > >connection failure. I suspect 0 is success but empty, and >1 meaning
    > >success and with messages.
    > >
    > >Granted this is fairly annoying and I would think getting that switched
    > >is high on their list.
    > >
    > >
    > > [/ref][/ref]
    some 
    > >
    > >-1 is initialization of the variable, just not a connection.
    > >
    > >
    > > 
    > >
    > ><snip code>
    > >
    > >http://danconia.org
    > >
    > >
    > >[/ref]
    >
    > --
    >
    >
    > ==============================================
    > Jim Maas Ph.D.
    > 29 Amber Close
    > Earley, Reading, UK
    > RG6 7ED
    >
    > 0118-935-3283
    > 0771-985-8698
    > jamaas at btinternet dot com
    >
    >
    >[/ref]


    Wiggins Guest

  5. #5

    Default Re: newbie problem with Mail::POP3Client;

    Hi Wiggins,

    It works! Thanks a bunch. I'm no computer newbie but am new to Perl,
    and where does one get started? It was the AUTH_MODE, which had to be
    set to 'PASS'. The machine it is connecting to is a Sun running Linux,
    but I don't know the flavour or what mailer. This is just a
    demo/prototype but will try to upgrade this security in future.

    I know the module installed the MAIL::POP3Client doentation when it
    installed but my bash just says
    no such command as perldoc ...

    Another challenge!

    Thanks

    Jim

    Wiggins d Anconia wrote:
     
    >
    >Doentation for modules available on CPAN are always available online
    >in a quite readable format, for example,
    >
    >http://search.cpan.org/~sdowd/Mail-POP3Client-2.16/POP3Client.pm
    >
    >Also you can access most modules doentation after installation by
    >issuing,
    >
    >perldoc <module name>
    >perldoc Mail::POP3Client
    >
    >

    >
    >Well yes, but it is 'DEBUG', and is passed to the constructor.
    >
    >

    >
    >AUTH_MODE sets the mode that the POP client will use to send the
    >password. The POP3 server on the other end may or may not support
    >"encrypted" (actually hashed but that's another topic) passwords in
    >which case the AUTH_MODE may need to be set to tell the client to send
    >the password in clear text. Setting AUTH_MODE to BEST seems to allow
    >the most flexibility.
    >
    >

    >
    >No problem.
    >
    >http://danconia.org
    >
    >
    > [/ref]
    >some
    >

    >>--
    >>
    >>
    >>==============================================
    >>Jim Maas Ph.D.
    >>29 Amber Close
    >>Earley, Reading, UK
    >>RG6 7ED
    >>
    >>0118-935-3283
    >>0771-985-8698
    >>jamaas at btinternet dot com
    >>
    >>
    >>
    >>
    >>[/ref]
    >
    >
    >
    >
    >[/ref]

    --


    ==============================================
    Jim Maas Ph.D.
    29 Amber Close
    Earley, Reading, UK
    RG6 7ED

    0118-935-3283
    0771-985-8698
    jamaas at btinternet dot com


    Jim Guest

Similar Threads

  1. First line in body of Mail::POP3Client
    By eng.john84@gmail.com in forum PERL Modules
    Replies: 2
    Last Post: March 23rd, 04:42 PM
  2. Mail::POP3Client Doesn't Work on Win32 perl
    By John in forum PERL Beginners
    Replies: 3
    Last Post: July 1st, 08:19 AM
  3. wannabie asks Mail::POP3Client && Mail::Audit
    By Wolf Blaum in forum PERL Beginners
    Replies: 1
    Last Post: December 31st, 02:00 AM
  4. Mail::POP3Client
    By Jeff in forum PERL Miscellaneous
    Replies: 3
    Last Post: October 9th, 07:59 AM

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