Code: PERL
## Changed Above Code A Little
use Parallel::ForkManager
use DBI;   
use strict;   

## connect to database and query the database, we will have a statement handler $stmt     
## open the newsletter text file and get the contents in the variable $mail_text     

my $pm = new Parallel::ForkManager(50);   
while(my($email_id) = $stmt->fetchrow_array())   
{     
  $pm->start and next;     
  open(SM,'|/usr/sbin/sendmail -f');       
  print SM "To: $email_id\n";      # The mail id variable was incorrected
  print SM "Subject: Newsletter\n\n";       
  print SM "$mail_text";     
  close(SM);       
  $pm->finish   }     
$pm->wait_all_children; ## wait for the child processes
pradeep like this