use IO::All; use Email::MIME; my @parts = ( Email::MIME->create( attributes => { filename => "test.xlsx", content_type => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", encoding => "Base64", name => "test.xlsx", }, body => io( "test.xlsx" )->binmode()->all, ), Email::MIME->create( attributes => { # filename => "test1.ods", content_type => "application/vnd.oasis.opendocument.spreadsheet", encoding => "Base64", name => "test1.ods", }, body => io( "test1.ods" )->binmode()->all, ), # gerates DEFECT attachment Email::MIME->create( attributes => { # filename => "DEF-test1.ods", content_type => "application/vnd.oasis.opendocument.spreadsheet", encoding => "Base64", name => "DEF-test1.ods", }, body => io( "test1.ods" )->all, ), Email::MIME->create( attributes => { content_type => "text/plain", disposition => "attachment", encoding => "quoted-printable", charset => "US-ASCII", }, body_str => "Hello there!", ), ); my $email = Email::MIME->create( header_str => [ From => 'casey@geeknest.com' ], parts => [ @parts ], ); # standard modifications $email->header_str_set( To => 'test@local' ); open (my $mh, '>', 'test.eml'); binmode $mh; print $mh $email->as_string; close $mh;