open my $output_fh, '>', \my $mime_body or die "In-memory handles are not supported by your version of Perl."; $mime->print( $output_fh ); close $output_fh; $mime_body =~ s!\n!\r\n!g; # use $mime_body as the string wherever you would use it with SOAP::Packager # I don't know if the following is valid, using a raw string as a MIME part: $soap->parts( [$mime_body] );