in reply to Re: (Ovid) Re: Bewildered in a Land of Shiny Perls
in thread Attaching an image to mail

Don't read UPLOAD to @attach. Pass it directly to MIME::Lite to create MIME message. Here bare bones of untested code:

# create message use MIME::Lite; $msg = MIME::Lite->new( From =>'me@myhost.com', To =>'you@yourhost.com', Subject =>'Helloooooo, nurse!', Type =>'image/gif', Encoding =>'base64', FH => \*UPLOAD, ); # send it using Net::SMTP my $smtp = Net::SMTP->new($mailserver); $smtp->mail ('me@myhost.com'); $smpt->to ('you@yourhost.com'); $smtp->data($msg->as_string);

See docs for relevant modules.

Update: fixed a couple of bugs and removed Cc: header from MIME message.