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. I had this working before but unfortunately
the printer configuration tool wiped out the filter, and my backup
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.

---------- 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.$$
# FILE_PS=$SPOODIR/ps.$$
[EMAIL PROTECTED]
EMAIL_FROM=

# 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"
        echo ""
        echo ""
        echo `date`
        echo ""
        echo ""
        echo "Content-Type: multipart/mixed; boundary=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 ---------------------

-- 
Neil Schneider                              pacneil_at_linuxgeek_dot_net
                                           http://www.paccomp.com
Key fingerprint = 67F0 E493 FCC0 0A8C 769B  8209 32D7 1DB1 8460 C47D
Secrecy, being an instrument of conspiracy, ought never to be the
system of a regular government.
- Jeremy Bentham, jurist and philosopher (1748-1832)

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to