#$i is an object i declared previously #read in all values (using CGI.pm) my @names = ¶m(); foreach my $field (@names) { $FORM{$field} = ¶m($field); } #read in the data uploaded, and save it into a hashkey if ($FORM{'resume'}) { #read in the resume's data my ($data,$size); while( $size = read( $FORM{'resume'}, $data, 1024) ) { $FORM{'resume_data'} .= $data; $FORM{'resume_size'} += $size; } } #---- #resume is the form field of type 'FILE' $FORM{'resume'} =~ m!([^/:\\]*)$!; #get file name/ext my $shortname = $1; #file name (with no slashes or colons) #---- #create a new message my $msg = MIME::Lite->new( From => "$FORM{'email'}", To => "personnel\@company.com", Subject => "Resume", Type => 'TEXT', Data => "Resume is to this email as <$shortname>", ) || return $i->error("Cannot create new email message object!"); #attach resume data $msg->attach( Type => 'application/octet-stream', Encoding => 'base64', Data => $FORM{'resume_data'}, Filename => $shortname, ) || return $i->error("Cannot attach your resume to the email!"); #tell MIME::Lite how to send this email MIME::Lite->send('smtp', 'company.com', Timeout=>30) || return $i->error("Unable to set the email 'send' properties!"); #actually send it $msg->send() || return $i->error("Unable to send email with your resume!");