my $_random_boundary = "NextPart_"; my @nums = ( 0 .. 9 ); my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw() ); $_random_boundary .= join("", @nums[ map { rand @nums } ( 1 .. 3 ) ]); $_random_boundary .= "_" . join("", @nums[ map { rand @nums } ( 1 .. 4 ) ]); $_random_boundary .= "_" . join("", @chars[ map { rand @chars } ( 1 .. 8 ) ]); $_random_boundary .= '.' . join("", @chars[ map { rand @chars } ( 1 .. 8 ) ]); my $__content_type = qq~multipart/alternative; boundary="----=$_random_boundary"~; my %mail = ( "To" => "$__to", "Subject" => "$__subject", "Content-Type" => $__content_type, ); my $_mail_Message = q~ This is a multi-part message in MIME format. ------=~ . $_random_boundary . q~ Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit ~ . $__text_message . q~ ------=~ . $_random_boundary . q~ Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable ~ . $__html_message . q~ ------=~ . $_random_boundary . q~-- ~;