fabiogaravelli
asked on
sendmail perl solution
Hi experts,
i have this situation on my server, crontab runs in cron.daily and check the last revision on subversion server,make backup ,gzip the last revision and so on , at the it make rsync on storage server.I need to send mail to some user with the result of the operation.I need that define the user on a file in this way ...user1@serverone.one,use r2@servert wo.two and so on. and the subject define on file in the same way on user ...
in this way , i can change the user list when i want , and the subject i populate it with result of crontab operation.
Bye
i have this situation on my server, crontab runs in cron.daily and check the last revision on subversion server,make backup ,gzip the last revision and so on , at the it make rsync on storage server.I need to send mail to some user with the result of the operation.I need that define the user on a file in this way ...user1@serverone.one,use
in this way , i can change the user list when i want , and the subject i populate it with result of crontab operation.
Bye
ASKER
ok ,but i need to pass as argument the value of To ,From , Message because they come from external configuration file.
file1..it contains the To parameters
file2 it contains the message
file1..it contains the To parameters
file2 it contains the message
%mail = ( To => $to,
From => $from,
Message => $message,
);
From => $from,
Message => $message,
);
ASKER
ok ozo.... but in which way i can create the $to... better how i can but in $to the content of the file ?
open T,"<file1" or die "file1 $!";
$to = <T>; #assuming it is on the first line of the file
close T;
open M,"<file2" or die "file2 $!";
$message = join'',<M>;
close M;
$to = <T>; #assuming it is on the first line of the file
close T;
open M,"<file2" or die "file2 $!";
$message = join'',<M>;
close M;
ASKER
can u explain me better i'm just little bit newbie on perl :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
som eprob with sendmail.pm installation ... make,make test make install everything is ok when i run perl myperl.pl i receive this...
Can't locate Mail/Sendmail.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8. 7 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at myperl.pl line 3.
what it mean?
Can't locate Mail/Sendmail.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.
what it mean?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
%mail = ( To => 'user1@serverone.one,user2
From => 'me@here.com',
Message => "This is a very short message"
);
sendmail(%mail) or die $Mail::Sendmail::error;
print "OK. Log says:\n", $Mail::Sendmail::log;