Print email

Stephen Liu satimis at yahoo.com
Fri Mar 28 07:50:03 PDT 2008


> On Wed, Mar 26, 2008 at 07:36:12AM -0700, Stephen Liu wrote:
> >
> >
> > Regarding the script/software for creating a PDF to email on;
> > http://www.cups.org/newsgroups.php?s15648+gcups.general+v15656+T0
> >
> > whether it is a full script for "print email" (send email)?
> >
> >
> > The script starts on;
> >
> > /etc/cups/ipemail :
> > --- CUT ---
> > localhost:me at example.com
> > 127.0.0.1:me at example.com
> > 192.168.1.1:someoneelse at example.com
> > 192.168.1.25:myaccount at gmail.com
> > --- CUT ---
> >
> > What do those "----- CUT ----"s refer to?  If it means removing
> > the line/lines between them, then this is NOT a full script.  Where
> > can I find the full script for sending emails with PRINT command?
>
> The --- CUT --- lines delimit the content of each of the several
> files needed. Sorry for not being clear about it.
>
> First file to create is /etc/cups/ipemail with a content similar
> to the one above, and so on for the other files.
>
> So really you've got one script named pdftoemail.sh, and two
> configuration files, only one of them being mandatory (tea4cups.conf)
> and the other one (ipemail) showing you what you can do for people
> not in LDAP. This is just an example, feel free to build on it.
>


Thanks for your advice.


Performed following test:-


$ cd /tmp
$ /tmp/ $ ls
No printout


$ svn co svn://svn.librelogiciel.com/tea4cups/trunk tea4cups
A    tea4cups/TODO
A    tea4cups/COPYING
A    tea4cups/tea4cups
A    tea4cups/clean.sh
A    tea4cups/NEWS
A    tea4cups/tea4cups.conf
A    tea4cups/CREDITS
A    tea4cups/README
Checked out revision 129.


$ cd tea4cups/
$ ls
COPYING  CREDITS  NEWS  README  TODO  clean.sh  tea4cups  tea4cups.conf


$ nano tea4cups.conf
$ /etc/cups/tea4cups.conf :
modifying its content as follows;
[global]
debug : no
directory : /var/spool/tea4cups/
keepfiles : no


Here whether I need to create the directory : /var/spool/tea4cups/ manually
???


$ sudo cp -p tea4cups.conf /etc/cups/
Password:

$ ls /etc/cups/ | grep tea4
tea4cups.conf


$ ls /etc/cups/ | grep ipemail
No printout

$ sudo nano /etc/cups/ipemail
putting following lines on the file:-
localhost:me at domain.com
127.0.0.1:me at domain.com
192.168.1.1:userA at domain.com
192.168.1.25:me at yahoo.com
* end *


Here I'm NOT very clear.

1)
The router IP here starts from 192.168.0.1 to 192.168.0.50

I don't have router IP 192.168.1.1 and 192.168.1.25
Whether I need to change them?


2)
Why I need adding them ?



[PDFGen]
$ ls /usr/local/bin/ | grep pdftomail.sh
No printout


$ sudo nano /usr/local/bin/pdftomail.sh

copying follows on the file:-

#! /bin/sh
#
USEREMAIL=`ldapsearch -x \
                      -H ldap://directory.example.com \
                      -b "ou=people,ou=example,ou=com" \
                      "uid=$TEAUSERNAME" \
                      "uid=$TEAUSERNAME" \
             | grep "^mail: " \
             | cut -f 2,2 -d " "`

if [ -z "$USEREMAIL" ] ; then
  USEREMAIL=`grep "^$TEACLIENTHOST" /etc/cups/ipemail | cut -f 2,2 -d :` ;
fi
if [ -n "$USEREMAIL" ] ; then
  PDFFILE="/tmp/$TEAUSERNAME-$TEAJOBID.pdf"
  ps2pdf - <"$TEADATAFILE" >"$PDFFILE" \
  && mpack -c application/pdf \
           -s "Fichier PDF $TEAUSERNAME (#$TEAJOBID)" \
           "$PDFFILE" \
           "$USEREMAIL" \
  && rm -f "/tmp/$TEAUSERNAME-$TEAJOBID.pdf" ;
fi
* end *


$ lpstat -v
device for Fax: socket://localhost:9900
device for HP_Printer: usb://HP/Deskjet%205700?serial=MY4B5131V9049M


device for PDFGen: tea4cups://
can't be found.


$ sudo /etc/rc.d/cups restart
:: Stopping CUPS Daemon                              [DONE]
:: Starting CUP Daemon                               [DONE]


$ lpstat -v
device for Fax: socket://localhost:9900
device for HP_Printer: usb://HP/Deskjet%205700?serial=MY4B5131V9049M


Still the same.


$ ls -l /usr/local/bin/pdftomail.sh
-rw-r--r-- 1 root root 716 2008-03-28 21:54 /usr/local/bin/pdftomail.s


Do I need to activate this file running
$ sudo chmod +x /usr/local/bin/pdftomail.sh
???


Whether I need to perform follows;
    $ cp tea4cups /usr/lib/cups/backend/
    $ chown root.root /usr/lib/cups/backend/tea4cups
    $ chmod 700 /usr/lib/cups/backend/tea4cups
    $ cp tea4cups.conf /etc/cupsd/ (I did already)
???


Furthermore I need to create the function sending emails direct on applications such as OOo, gedit, etc. with the PRINT command not to creat PDF files.  Whether in this arrangement I can send emails on application by printing the content as PDF file?  Then what about if I need to create PDF files but NOT email it?


TIA


B.R.
Stephen L






More information about the cups mailing list