if ( $header->[2] =~ /html/i ) { $tt->process( $file_html, $tt_vars, \$html_out ) || warn $tt->error(), "\n"; $vars{Type} = 'multipart/alternative'; $msg = MIME::Lite->new( %vars ); # Add parts (each "attach" has same arguments as "new"): $msg->attach( Type => 'text/plain', Data => $text_out, ); $msg->attach( Type => 'text/html', Data => $html_out, ); } $msg->send;