#!/usr/bin/perl use strict; use warnings; use Email::MIME; print "searching using regexp...\n"; open(my $in, "<", "DirectX.log") or die "Can't open DirectX.log: $!"; while (<$in>) { if ($_ =~ /eroare+/) { print "found eroare\n"; my $message = Email::MIME->create( header_str => [ From => 'alexandru.fatu@hotmail.com', To => 'alexandru.fatu@hotmail.com', Subject => 'Error!', ], attributes => { encoding => 'quoted-printable', charset => 'ISO-8859-1', }, body_str => "Eroare gasita: $_", ); # send the message use Email::Sender::Simple qw(sendmail); sendmail($message); } } close $in or die "$in: $!";