use MIME::Lite; my ($dir) = (@ARGV); if (! -d $dir) { print "Usage: send_email.pl \n"; exit(0); } my @files = glob("$dir/*.JPG"); foreach my $filename (@files) { print "$filename\n"; my $subject = "Photo $filename ($dir)"; my $msg = MIME::Lite->new( From => 'yuonlamp@yahoo.com', To =>'yuonlamp@yahoo.com', Cc =>'yuonlamp@yahoo.com', Subject => $subject, Type =>'TEXT', Data => $subject, ); $msg->attach( Type =>'image/jpeg', Path => $filename, Filename => $filename, ); $msg->send(); }