[cups.general] CUPS and email

Jerome Alet alet at librelogiciel.com
Tue Nov 21 09:17:59 PST 2006


On Tue, Nov 21, 2006 at 07:32:44AM -0600, Minatra, Pat H. wrote:
> I am trying to find a way to setup a CUPS printer that will email
> through send mail to a user rather than actually print to a network
> printer.
> 
> Has anyone done this or does anyone know how this could be accomplished?
> 
> Thanks for any help or info in this matter as I have not been able to
> find anything in the documentation on this topic or subject.

The problem is that you don't necessarily know the email
address from an username.

<shameless plug="on">
But if you've got some script to grab or construct the email address
from the username, I think Tea4CUPS (http://www.pykota.com/software/)
is exactly the tool you need.

Install tea4cups as explained in its documentation, then in 
tea4cups.conf in a section named after your print queue do something 
like this : 

--- CUT ---
[TheNameOfYourPrintQueue]
prehook_sendmail : /usr/bin/mail-files $TEAUSERNAME at example.com application/postscript "Your PostScript job" $TEADATAFILE
--- CUT ---

mail-files is part of GNU-Sharutils

Then in CUPS' printers.conf, define the DeviceURI for 
TheNameOfYourPrintQueue to read : 

--- CUT ---
DeviceURI tea4cups://
--- CUT ---

Restart CUPS if you did this without using lpadmin.

This change will route all print jobs sent to 
TheNameOfYourPrintQueue through Tea4CUPS, which in turn will mail 
them to the username at example.com 

Of course you may need to improve this for example if your 
printer driver doesn't produce PostScript, but at least you
know where to start.

IMPORTANT : the example above is UNTESTED, but probably works as-is.
</shameless>

hth

Jerome Alet





More information about the cups mailing list