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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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"):


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.