The MIME-Lite package consists of only one module, MIME::Lite. It provides a simple and standalone way of creating MIME-compliant email messages from Perl scripts. It contains a subset of the functionality available in the MIME-tools package. It can also use the MIME::Base64 and MIME::QuotedPrint modules, if they are available on the system. MIME-Lite was created by Eryq ([email protected]).
The constructor is called to create a new message, with the
message headers and their values being given in a hashtable as
arguments to the constructor. The attach
method is
called to add MIME message parts onto the message. When completed, the
message may be sent (under Unix) or printed to a file handle.
The hashtable passed in as arguments to the constructor or the
build()
function can include any of the following
message headers and their values:
Bcc Encrypted Received Sender Cc From References Subject Comments Keywords Reply-To To Content-* Message-ID Resent-* x-* Date MIME-Version Return-Path Organization
Contents:
Lite.pm
Version Documented: 1.123 dated 11 December 1996
Dependencies:
MIME::Base64 used if available.
MIME::QuotedPrint used if available.
MIME::Lite Synopsis:
Constructors: new() new(String [] args) Global variables: VERSION # The version number of the module. QUIET # If 1, do not report warnings. PARANOID # If 1, do not use MIME::Base64 or MIME::QuotedPrint. Public instance variables: SENDMAIL # Set to the local command to use for sending. # mail messages (Unix only, there is a default). Public instance methods: String attach (Lite message, hashtable parameters) String attach (Lite message) Lite build (Lite message, hashtable parameters) null top_level (Lite message, boolean set) null add (Lite message, String header, String value) String attr (Lite message, String attr, String value) Lite delete (Lite message, String header) String[] fields (Lite message) String filename (Lite message, String filename) int get_length (Lite message) String replace (Lite message, String header, String value) boolean binmode (Lite message) String binmode (Lite message, boolean override) String data (Lite message, String[] data) String path (Lite message, String path) int read_now(Lite message) int sign (Lite message, hashtable signature) int print (Lite message, FileHandle outhandle) int print_body (Lite message, FileHandle outhandle) int print_header (Lite message, FileHandle outhandle) String as_string (Lite message) String body_as_string (Lite message) String header_as_string (Lite message) int send (Lite message) String sendmail (Lite message, String args) String quiet (Lite message, boolean onoff) Inner classes: MIME::Lite::IO_Handle MIME::Lite::IO_Scalar
The following example shows the creation of a simple message with one MIME body part that is an image. The resulting message is then printed to STDOUT.
# Prepare a multipart message. $msg = new MIME::Lite From =>'[email protected]', To =>'[email protected]', Subject =>'More info on Agentina', Type =>'multipart/mixed'; # Add an image to the message. attach $msg Type =>'image/jpeg', Path =>'/home/dwood/world.jpg', Filename =>'world.jpg'; # Print the message to STDOUT. $msg->print(*STDOUT);
18.191.5.239