How to Use the Perl POP Connector?

Asked By 50 points N/A Posted on -
qa-featured

Good Day Everyone!

Is there a so called Perl POP Connector? Has anyone tried to use this? Can anyone please tell me how to create a connection to POP3 server using Perl programming language? I need guidance from experienced programmers in Perl. If anyone can provide sample codes or simple tutorials and printed materials either books or ebooks, I would really appreciate it.

Thank you in advance for helping.

Aldo Dillan

SHARE
Answered By 10 points N/A #135053

How to Use the Perl POP Connector?

qa-featured

 

Dear Aldo,

My main assumption is that you understand how POP3 works. Perl5 has an inbuilt class that facilitates access to POP3 servers i.e. Net::POP3. It implements a client interface to the POP3 protocol. You only need to create a new Net::POP3 object and all the POP3 commands are accessed via method calls on the object.

Below is sample code and you can check for methods supported from the documentation.

    use Net::POP3;

    $popServer = Net::POP3->new('host_POP3');

    $popServer = Net::POP3->new('host_POP3', Timeout => 60);

 

    if ($popServer ->login($user, $pass) > 0) {

      my $messagez = $popServer->list; # hashref of messagez => size

      foreach my $ messagez (keys %$ messagez) {

        my $msg = $popServer->get($messagez);

        print @$msg;

        $popServer->delete($messagez);

      }

    }

    $popServer->quit;

Login/Register to Answer

Related Questions