Sending Attached files from Perl program

I am trying to send an attached file from my perl program.  The e-mail must also have text content in the body of the email as well.  please advise.  Thanks.  
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

ventolinConnect With a Mentor Commented:
use MIME::Lite;

    Create a multipart message (i.e., one with attachments):

        # Create a new multipart message:
        $msg = new MIME::Lite
                    From    =>'',
                    To      =>'',
                    Cc      =>',',
                    Subject =>'A message with 2 parts...',
                    Type    =>'multipart/mixed';
        # Add parts (each "attach" has same arguments as "new"):
        attach $msg
                    Type     =>'TEXT',  
                    Data     =>"Here's the GIF file you wanted";  
        attach $msg
                    Type     =>'image/gif',
                    Path     =>'aaa000123.gif',
                    Filename =>'logo.gif';

    Output a message:

        # Format as a string:
        $str = $msg->as_string;
        # Print to a filehandle (say, a "sendmail" stream):

    Send a message:

        # Send in the "best" way (the default is to use "sendmail"):

mul9933Author Commented:
Do I have to install MIME::lite on my UNIX web server?  If so, where do I get it and how do I install it.

or link from


perl -MCPAN -eshell

then follow the instructions to setup the shell. when done, type

install Mime::Lite

All Courses

From novice to tech pro — start learning today.