sub sql { my @output = $sqlCount->execute; while (@output=$sqlCount->fetchrow_array) { print "data: @output \n"; } $sqlCount->finish(); $dbcon->disconnect(); } my $msg = MIME::Lite->new( from=>'', to =>'', subject=>'', Data=>'&sql;' ### yeah, I wish ); $msg->send('smtp','foobar',Timeout=>60);