Libnet

The libnet package includes a number of useful network protocols and utilities for Perl5. The two specific modules that relate to electronic mail are the POP3 and SMTP implementations. Both of these modules assume familiarity with the appropriate protocol, since the methods act as interfaces to individual protocol commands. These modules were written by Graham Barr ().

Contents:

  • POP3.pm

  • SMTP.pm

  • Several others that don’t relate directly to electronic mail

Version Documented: 1.0605 dated 22 December 1997

The dependencies for Libnet are as follows:

  • Perl 5.001 or higher

  • Net::Cmd

  • Net::Config

  • IO::Socket (SMTP.pm)

  • MD5 (if using APOP authentication for POP3.pm)

Libnet provides the following modules, which are listed with a synopsis of each:

Net::POP3 Synopsis:

Constructors:
    POP3 new ()
    POP3 new (String popserver)
    POP3 new (String popserver, String[] options)

Public instance methods:
    boolean user (POP3 pop, String username)
    boolean pass (POP3 pop, String password)
    boolean login (POP3 pop)
    boolean login (POP3 pop, String username)
    boolean login (POP3 pop, String username, String password)
    boolean apop (POP3 pop, String username, String password)
    String[] top (POP3 pop, int msg_num)
    String[] top (POP3 pop, int msg_num, int num_lines)
    hashtable list (POP3 pop)
    int list (POP3 pop, int msg_num)
    String[] get (POP3 pop, int msg_num)
    int last (POP3 pop)
    int[] popstat (POP3 pop)
    hashtable uidl (POP3 pop)
    String uidl (POP3 pop, int msg_num)
    boolean delete (POP3 pop, int msg_num)
    boolean reset (POP3 pop)
    boolean quit (POP3 pop)

Net::SMTP Synopsis:

Constructors:
    SMTP new ()
    SMTP new (String host)
    SMTP new (String host, String[] options)
 
Public instance methods:
    String domain (SMTP smtp)
    boolean hello (SMTP smtp, String domain)
    boolean mail (SMTP smtp, String address)
    boolean mail (SMTP smtp, String address, String[] options)
    boolean send (SMTP smtp, String address)
    boolean send_or_mail (SMTP smtp, String address)
    boolean send_and_mail (SMTP smtp, String address)
    boolean reset (SMTP smtp)
    boolean recipient (SMTP smtp, String[] addresses)
    boolean to (SMTP smtp, String[] addresses)
    boolean data (SMTP smtp)
    boolean data (SMTP smtp, String[] data)
    String[] expand (SMTP smtp, String address)
    boolean verify (SMTP smtp, String address)
    String[] help (SMTP smtp)
    String[] help (SMTP smtp, String subject)
    boolean quit (SMTP smtp)

The following example uses the POP3 module to determine the number of messages in a POP3 mailbox and the size of the mailbox.

# Use the POP3 module.
use Net::POP3;

# Create a new POP3 object for the POP3 server named.
$pop = Net::POP3->new('popserver.somedomain.com'),

# Log into the POP server using basic authentication.
$pop->login ("dwood", "mypassword");

# Get the number of messages and the size of the mailbox.
($num_msgs, $size) = $pop->popstat();

# Reset the mailbox. We don't use quit because quit causes messages # marked for deletion to be
deleted. Since we didn't mark any, we'll # be cautious :)
$pop->reset ();
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.29.145