begin quoting Neil Schneider as of Wed, Oct 12, 2005 at 01:21:09PM -0700: > I'm working on a printer filter on a system using LRPng, that will > allow people to send printouts from a custom application through email > to designated addresses.
Along the lines of "lp1 is the laser printer, lp2 is the inkjet, and lp3 is email to [EMAIL PROTECTED]" ? > I had this working before but unfortunately > the printer configuration tool wiped out the filter, and my backup Lovely. > file was not good. Here is the current version of the code. It should > send the report as a plain text attachment to the email, so it can be > printed out directly. /me makes smart-aleck comment about uuencode working better anyway > ---------- begin code ----------------- > > #!/bin/bash > > # Capture the spool file > # > SPOOLDIR=$(pwd) > cat - >$SPOOLDIR/print.$$ > > #Declare variables > # path to temporary files > # FILE_PDF=$SPOODIR/print$$.pdf > FILE_PRINT=$SPOODIR/print.$$ SPOODIR? Wouldn't SPOOLDIR work better? > # FILE_PS=$SPOODIR/ps.$$ > [EMAIL PROTECTED] > EMAIL_FROM= To be filled in by the user? Or did you just leave out the generating code? > # Path to email server program > SENDMAIL="/usr/sbin/sendmail.postfix" > MIMENCODE="/usr/bin/mimencode" > > # Do we need a username? > # How about a comment line, or header? > ( > echo "To: $EMAIL_ADDRESS" > echo "From: $EMAIL_FROM" > echo "Subject: Outgoing Invoice print job" No X-Printer-To-Email: Version 0.2a line? :) > echo "" > echo "" > echo `date` > echo "" > echo "" > echo "Content-Type: multipart/mixed; boundary=lprtomail" Most of the time I see long lines of dashes, random numbers, and suchlike, presumably to avoid accidently generating a false boundary. What if the text I'm sending contains "^--lprtomail$" ? > echo "Content-Description: Delivery Invoice;" > echo "Content-Type: text/plain; charset=\"us-ascii\"" > echo "Content-Transfer-Encoding: 7bit" > echo "" > echo "This email contains an attachment which you can print on > your local printer" > echo "--lprtomail" > echo "Content-Type: text/plain" > echo ""Content-Transfer-Encoding: base64" > cat $FILE_PRINT > echo ""; > echo ""; > ) | 2>&1 $SENDMAIL -oi $EMAIL_TO > > ------------- end code --------------------- Nifty. I see you're using bash -- what bashisms are in that script? -Stewart -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
