### Create a new multipart message: $from = 'me@myworld.com'; $email = 'you@yourworld.com'; $msg = MIME::Lite->new( From =>"$from", To =>"$email", Subject =>"View User Report Results", Type =>'text/plain', Data =>"$data" ) || die "Error Creating MIME Body: $!\n\n"; # Attach the HTML document if the email is not empty if ($TheDocument2 !~ /E-mail.+$/) { # FIRST, CREATE A NEW DATA FILE my $gzip = '/bin/gzip'; my $unzipf = '/usr/temp/reports/YourResults.txt'; my $zipf = '/usr/temp/reports/YourResults.txt.gz'; open (UNZIPPED, ">$unzipf") || die "Cant prepare the unzipped file $unzipf\n\n"; $script{guts} =~ s/\n/\r\n/g; print UNZIPPED $script{guts}; close (UNZIPPED); # NOW ZIP THE FILE UP! system ("gzip -f $unzipf"); # OPEN THE ZIPPED FILE, AND GET DATA FROM IT undef $/; # NOW ATTACH THE ZIPPED FILE TO THE EMAIL! $msg->attach( #Type =>'application/x-gzip', Type =>'application/zip', Disposition =>'attach', #Data =>"$zip_data", Path =>"$zipf", Filename =>'YourResults.txt.gz' ) || die "Error Creating MIME Attachment: $!\n\n";; # DELETE THE ZIP FILE system ("rm -f $zipf"); } #$msg->send(); # I WISH TO SEND THIS VIA SMTP! my $message_body = $msg->body_as_string(); # Set this variable to your smtp server name my $ServerName = 'mail.policy.net'; my $smtp = Net::SMTP->new($ServerName) || die "Couldn't connect to server"; $smtp->mail ( $from ); $smtp->to ( $email ); $smtp->data(); $smtp->datasend($message_body); $smtp->dataend(); # Close the connection $smtp->quit(); #### This is a multi-part message in MIME format. --_----------=_103832648034060 Content-Disposition: inline Content-Length: 452 Content-Transfer-Encoding: binary Content-Type: text/plain Here are the results of your View Users Report search. Save this file to your hard drive and extract it using WinZip (Windows) or StuffIt (Macintosh). Once extracted, you can view and manipulate the data file by using a spreadsheet application like Microsoft Excel or another program of your choice If you have other questions please contact your IDI account representative or send an email to request@idi.net. Thank You --_----------=_103832648034060 Content-Disposition: attach; filename="YourResults.txt.gz" Content-Transfer-Encoding: base64 Content-Type: application/zip; name="YourResults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