in reply to Strange result using Mail::POP3Client

Webmail::vPOP3 is a superclass of Mail::POP3Client in this example which shows the error handling you need as pointed out by BrowserUK ie check $obj->Message for either OK or ERR...

sub open_pop3_connection { my $pop = new Webmail::vPOP3 ( mailroot => $USE_MAILROOT, pop3_init => { USER => $global{username}, PASSWORD => $global{password}, HOST => $POP_SERVER, AUTH_MODE => $POP_AUTH_MODE }, cwd => $global{cwd}, default_folders => { inbox => $INBOX, drafts => $DRAFTS, deleted => $DELETED, sent => $SENT, }, delim => $DELIM, debug => 0, folder_icons => "$IMAGE_LOCATION/folder_icons", Lplus => \&Webmail::Lplus, Lminus => \&Webmail::Lminus, Tplus => \&Webmail::Tplus, Tminus => \&Webmail::Tminus, folder_msg_text => \&Webmail::folder_msg_text, file_msg_text => \&Webmail::file_msg_text, ); unless($pop->Message =~ m/^\+OK/){ ($pop->Message =~ m/ERR(.*)/) ? show_login("$CONNECTION_FAILED: $1") : show_login("$CONNECTION_FAILED:" . $pop->Message); } # reset the session time after a vaild login $global{last_active} = time(); return $pop; }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Strange result using Mail::POP3Client
by Anonymous Monk on Jun 25, 2003 at 11:17 UTC
    not really a solution to her problem, more like an advertisement for your own module.

      1) It is a solution ie check $obj->Msg as shown for either OK or ERR. Simply the explicit step required as alluded to by BrowserUK

      2) The module (actually an app wrapped around a lot of modules) is not publicly available either free or for sale, it is in house company code for our webmail system :-)

      So, not much of an ad but definitely a solution. Sure I cut and pasted the code and noted why it did not say Mail::POP3Client->new

      And?

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print