foreach my $dirContent ( @dirContents ) { #mail contents and attachment open (MESSAGE, "$dirContent"); my @message = ; my $msg = MIME::Lite->new( From => $sender, To => $recipient, Subject => $dirContent, Data => \@message, Type =>'multipart/mixed' ); close ( MESSAGE ); $msg->send; } closedir ( CHANGEME ); exit (0);