#!/usr/bin/perl use MIME::Base64; use MIME::Lite; open FILE, "jpg/attachment-start.jpg"; while (read (FILE,$buf,45)) { $added .= encode_base64($buf); } open OUT1, ">blah1"; print OUT1 $added; close FILE; close OUT1; $msg = MIME::Lite->new(From => "me\@myhost.com", To => "blah\@blah.com", Type=> "image/jpg", Encoding =>"base64", Path => "jpg/attachment-start.jpg"); $message = $msg->as_string; open OUT2, ">blah2"; print OUT2 $message; close OUT2;