#!/usr/bin/perl -w
######################################################################
# attach.pl
######################################################################
# Perl Power! - Michael Schilli 1998
######################################################################

use MIME::Lite;

$msg = MIME::Lite->new( 
    From       => 'sender@host.com',      # sender
    'Reply-To' => 'reply@host.com',       # return address
    To         => 'to@host.com',          # addressee
    Subject    => "The subject!",         # subject
    Type       => "multipart/mixed");     # announce attachments
                           
$msg->attach(                             # include normal text
    Type     => 'text/plain',             # plain text
    Data     => 'JPG image to follow!');  # content

$msg->attach(                             # include image
    Type     => 'image/jpg',              # JPG image
    Path     => 'source.jpg',             # source file
    Encoding => 'base64',                 # encoding scheme
    Filename => 'name.jpg');              # name after arrival

$msg->attach(                             # include binary
    Type     => 'octet/stream',           # binary type
    Path     => 'data.tgz',               # source file
    Encoding => 'base64',                 # encoding scheme
    Filename => 'data.tgz');              # name after arrival

$msg->send();                             # pass on to sendmail

