attaching a file to e-mail

i have a script that receives and saves a file on my server and sends an e-mail with all form data including a link to the file saved. how do i instead attach the file to the e-mail ?

sorry about the few points, but its all i have right now :-)

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 uuencode on that file before you send it. Like this:
 uuencode in_file_name out_file_name | /usr/bin/sendmail <your@email>

Unix/linux. virtualave is unix.

On wintel you could zip it and then send.
use Mail::Mailer;
   $mailer= Mail::Mailer->new();
   mailer->open( {From => $me,
                  To   => $you,
                  Subject => $subj,
   or die "Can't open $! \n";
print $mailer $msg;
hatecaplettersAuthor Commented:
looks good, but where do i specify what file i want to attach ?
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

in_file_name in 1-st case and $msg in 2-nd
hatecaplettersAuthor Commented:
I'm sorry, but I have some problems seeing how that should attach the file to the e-mail with the rest of the form data..
well, you asked how to attach file and I told you. As for form data it can also be saved in file.

sendmail is what you usually use to send mail and uuencode makes an attachment out of file, binary or text...

If you still don't see it - forget it.
hatecaplettersAuthor Commented:
use MIME::Lite;

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
Kim RyanIT ConsultantCommented:
There are several CPAN packages that handle mail attachments. As ozo suggested, MIME::Lite will work, as will Mail::Sender. Mail::Mailer will not handle attachments as far as I know.

You will need to download and install this module and 2 other supporting ones, see for details.

use Mail::Sender;
$sender = new Mail::Sender
   smtp => '',
   from => ''
   to => '',
   subject => 'your subject',
   msg => "your message",
   file => 'filename.txt'

hatecaplettersAuthor Commented:
short, but just what I needed (having read some documentation for 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.