LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author]
  From: Adrian Butterworth <adrian@econ-outlook.com.au>
  To  : linuxsa@linuxsa.org.au
  Date: Mon, 3 May 1999 23:44:08 +0930

Re: email to printer as well as email?

Ben
you can pipe mail to any application! for example 

add the following to your /etc/aliases file (with or without the comments)

# send the body to the printer using sed to strip the headers
# works for text and postscript files eg "mail printer <sample.ps"
printer:  |"sed -e '1,/^$/ d'"|/usr/bin/lpr

then run "newaliases" to cause a reread of the file

now any plaintext or postscript body you email to "printer@your.host"
will get slapped in the printqueue.

if you get your mail client to "cc" to "printer" any email it sends you'll
end up with a hard copy.

Note of warning: this simple filter will not decode html or binary attachments
so don't "cc" anything your standard print filter can't swallow or you'll use
a lot of paper.

You'll most likely want something fancier than the sed above to preprocess the
mail.

an easy way to play around is to pipe into your own script e.g.
  in /etc/aliases put
  printer:  |/root/scripts/printmail

  simple example for /root/scripts/printmail
  (needs to be executable by everybody)
  #!/bin/sh
  cat - > /tmp/print.this.text$$
  printmail /tmp/print.this.text$$ | lpr 
  rm /tmp/print.this.text$$

there are all sorts of utilities you can use, formail, html2ps ...
play till you find what you like

regards
Adrian Butterworth


On Mon, 03 May 1999, Ben Donohue wrote:
> is there a way to setup email such that the email gets sent and also a
> copy gets printed on the printer?
> that is, the printer is at the sending end not the receiving. 
> the mail server sends the email to wherever but prints out what it has
> sent.
> 
> can someone point me in the right direction?
> maybe hylafax does this to a printer?
> not quite sure where to start.
> -- 
>                                                                   _|_
>                                                                    |
> Thanks,                                 B V M Solutions PTY Limited
> Ben Donohue                                    Web Hosting & Design
> donohueb@bvm.com.au                  Small Business Office Networks
> Mobile: 0417 018 600                          http://www.bvm.com.au
> 
> Freedom isn't doing what you want...  Freedom is knowing what to do
> 
> -- 
> Check out the LinuxSA web pages at http://www.linuxsa.org.au/
> To unsubscribe from the LinuxSA list:
>   mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject

-- 
Check out the LinuxSA web pages at http://www.linuxsa.org.au/
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author]
Return to the LinuxSA Mailing List Information Page