HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

MIME Attachments and Faxmail (again)



Ok last time I tried this question and got zero responses. Is there not a
single user out there who use the faxmail program included with HylaFAX
for anything other than the default mime types (text/plain,
application/postscript, etc..). 

My faxmail setup works fine. In short here is the whole setup.

My hostname is itchy. On itchy the /etc/aliases has entry describing the
fax recipients like this:

mike-fax	"|/usr/local/bin/faxmail -d mike-fax@9455454"

That's the whole setup. When I send mail to mike-fax@itchy.wdc.com, the
e-mail shows up on Mike's fax machine about two minutes later.

Now I want to use the same setup to send an HTML document via fax to Mike.
Directly pasted from the faxmail manpage ....

-----------------------snip-------------------------------
For each MIME body part with type T and
subtype S faxmail checks first for  an  executable  script
named  T/S in the converter hierarchy.  If a script exists
then it is run and the result is appended  to  the  output
PostScript  document.   Otherwise  if the part has builtin
support then it is processed directly.  Any part that does
not  have  external  or  builtin  support is discarded and
replaced by a message that indicates the part was removed.

---------------------snip ----------------------------------

In my /usr/local/lib/fax/hyla.conf, I have the following line:

MimeConverters: /usr/local/lib/fax

And in that directory, I have another directory named 'text'. In the text directory I have a script named 'html', which would (according to the manpage) be run by any mail attachments with the MIME type of 'text/html'.

The html script simply contains the following lines:

#!/usr/bin/perl
$filename = $ARGV[0];
open(HTML2PS, "html2ps -D $filename |");
open(COPY, ">/tmp/faxcopy.ps");
while (<HTML2PS>) {
        print STDOUT "$_";
        print COPY "$_";
}

Which basically opens a filehandle named 'HTML2PS' which reads a pipe from the output of the command 'html2ps -D $filename'. I also open a temp file named /tmp/faxcopy.ps so I can check this file with ghostscript.

Inside the while loop, I push the output from the pipe to STDOUT, which should be read by faxmail ?

I checked the temp file and it does contain valid Postscript, as output by the html2ps command.

Has anyone else had any luck with making mime scripts work with faxmail. Does anyone have any example scripts ?

TIA

Aaron Newsome




Project hosted by iFAX Solutions