Friday 15 January 2010

Scan to email

I thought other GPs might find this useful:

Our photocpier has a scan function which transmits the scanned result onto a FTP server. Many multifunction scan/copy/printer can do this.

I rigged this up with my practice Linux server so that all scans get dumped in one directory there (was simple, just followed the copier's manual)

I then used incron to watch this directory and use a small script to email to the practice account all new files in there.

From there you can then forward them on via email to others who need them.

Works great. It already has made a difference to the way the practice manager works.





The incrontab looks like this:
/home/scans/public_html IN_CLOSE_WRITE /home/scans/bin/mail_attachment.sh $@/$#


The mailscript is simple too:

#!/bin/sh
echo "This is a scan from the photocopier" > /tmp/msg.txt
mutt -s "scans attached" -a $1 practicemail@localhost < /tmp/msg.txt

rm /tmp/msg.txt