use IO::All; # install this module first push @parts, Email::MIME->create( attributes => { filename => $attachments{doc_name}, content_type => $attachments{doc_mime_type}, disposition => 'attachment', encoding => 'base64', name => $attachments{doc_name} }, body => io($attachments{doc_name})->all, # add this line );