Re: Redirect printer output to email?
Marcelo E. Magallon wrote:
> #!/usr/bin/perl
>
> my $MAIL;
>
> open MAIL, '|mail -s "Some subject" some@address';
>
> while (<>) {
> print MAIL;
> print;
> }
>
> close MAIL;
>
> Of course, you might need something more fancy to accomodate your pager's
> needs. Also, the second filter could bounce to something else, ie, it could
> just filter stuff and pass it to another "printer" (which is what I do
> locally to do proper filtering before sending the jobs to a Windows NT
> machine)
>
> HTH,
Yes, it does help. The test message I sent to the "pager" (actually
"beeper") printer bounced to my real printer, so that part works (it
needs some clean-up, but that's for another day).
However, I did not get a mail notification.
I sent a test message by typing at the command prompt:
mail -s "911 Test" kent.west@infotech.acu.edu
and typed in short message and Ctrl-D'd it and the message arrived in my
email client.
But I don't get anything if I type at the command prompt:
ls -l | lpr -Pbeeper
I don't know enough about scripting yet to know how the script works.
What does the
my $MAIL
command do? I can sortta understand the rest of it; while the input is
not "", print a line to MAIL. Finally, print a blank line to MAIL (to
account for the CC: option?) and then shut down mail.
Reply to: