This is very nice if you want to create a virtual office. Many a independent consultant might be interested in this.
Once you have extracted the tiff files out of the email messages, you can do with them whatever you want. For this article, we will convert them to pdf files and put them in a web directory for easy download.
### Copy the mail over to a temporary file. cp /var/spool/mail/Username File.mail ### Extract the tiff files. uudeview File.mail ### Let us assume the tiff file is extracted as the name MyFile.tiff ### Convert it to postscript tiff2ps MyFile.tiff > TempFile.ps ### Convert it to pdf ps2pdf TempFile.ps TempFile.pdf ### move it mv TempFile.pdf /www/docs/pdf/TempFile.pdfThat is how you can do it manually. However, we want to automate the process. Two scripts in the next section will do that.
#!/usr/bin/perl ## We assume you have uudeview installed. ## We assume you have a public_html directory which your webserver has been ## properly configured to see. ### This perl script is not properly secured since it is possible to make ### a weird configuration for the name of the fax file, which in theory ### could mess up the command line statements. Use at your own risk. my $User = "Mu_Username"; my $Temp = "/home/$User/Temp/fax"; system "cp /var/spool/mail/$User /home/$User/Temp/"; system "cp /dev/null /var/spool/mail/$User"; system "/usr/bin/uudeview -o -i -d -p /home/$User/tiff/ /home/$User/Temp/fax"; system "cp /dev/null /home/$User/Temp/fax"; my @Old_Pdfs = </home/$User/public_html/pdf/*.pdf>; my $No = @Old_Pdfs; foreach my $File (</home/$User/tiff/*.tif>) { $No++; my $Ps = $File; $Ps =~ s/\.tif/\.ps/g; $Ps =~ s/tiff/ps/; system "/usr/bin/tiff2ps $File > $Ps"; ### If you want to print this, uncomment # system "lpr $Ps"; my $Pdf = $Ps; $Pdf =~ s/\.ps/\.pdf/g; system "/usr/bin/ps2pdf $Ps $Pdf"; ### Either choose to keep the default name of the file or number it # system "mv $Pdf /home/$User/public_html/pdf/"; system "mv $Pdf /home/$User/public_html/pdf/$No.pdf"; system "rm $Ps $File;"; }Here is the crontab file you will need. run the command
crontab Crontabin order to get to be automated.
#!/bin/sh 0,15,30,45 * * * * /home/UserName/Cron.pl >> /home/UserName/cron_log 2>&1
Phil Hunter from COLUG first told me about this a year or two ago. He just dumps the faxes to a printer. It wasn't of much use then when I had an office and a fax machine, but I have found it useful since I moved out to California. My next goal is to send a fax through a modem, and then I will be able to send and receive faxes when I am not in my office in the Bay Area.