Re: Fax Gateway Usage with Hylafax
I wrote a simple PHP script using PHP's MimeDecode module. This script takes receives a message on stdin (via Postfix 'pipe') with one or more attachments, writes each attachment out to a temp file, then calls Hylafax with the appropriate arguments and a list of the tempfiles - and then deletes the temp files. This functions - but it strikes me as inelegant. I'm also concerned about possible breakage points, including: 1. One or more large attachments may result in significant resource consumption. Being able to attach a 50-page manual and click send may become an attractive option to some users. 2. If, for whatever reason, there's a break in processing in the script, there would be a quantity of temp files that wouldn't be deleted. I suppose if I was using a consistent naming scheme for the temp files, or placed them in a subdirectory, I could use an hourly cron job to make sure they were cleaned up. That approach has always bothered me - but I don't know of a better one. Anyone have any suggestions on alternate implementations I might pursue? -- Daniel
Re: Fax Gateway Usage with Hylafax
On Jul 26, 2009, at 11:58 AM, Daniel L. Miller wrote: I suppose if I was using a consistent naming scheme for the temp files, or placed them in a subdirectory, I could use an hourly cron job to make sure they were cleaned up. That approach has always bothered me - but I don't know of a better one. Anyone have any suggestions on alternate implementations I might pursue? Sure, you can use find to expire the old files. find $HOME/Maildir/.SPAM/{cur,new} -type f -ctime +7 -delete That deletes all the spam over a week old in my spam folder. I run that once a day out of a crontab: 11 4 * * * find $HOME/Maildir/.SPAM/{cur,new} -type f -ctime +7 -delete (run at 0411 everyday) -- Man is born free, but is everywhere in chains.
Re: Fax Gateway Usage with Hylafax
Daniel L. Miller: I wrote a simple PHP script using PHP's MimeDecode module. This script takes receives a message on stdin (via Postfix 'pipe') with one or more attachments, writes each attachment out to a temp file, then calls Hylafax with the appropriate arguments and a list of the tempfiles - and then deletes the temp files. I'm sure that you could use the print system to do most of the queue management and retry logic for you. Just encode the phone number in the job, submit it with Postfix, and provide a printer driver that talks to the FAX software. Decent print system has accounting so you can even monitor usage. Wietse
Re: Fax Gateway Usage with Hylafax
On Monday 13 July 2009 13:08:29 Daniel L. Miller wrote: I'm trying to implement an email-to-fax gateway using Postfix + Hylafax. Hylafax's provide faxmail command does function - but it doesn't accomplish what I want. In particular, I would like to: Note, this is all pretty much outside the scope of a MTA, whose job is mail *transport* not mail creation and manipulation. 1. Send an e-mail with one or more attachments intended for faxing. The attachments will already be in hylafax-recognizable format (postscript, pdf, or tiff). Command-line tools which can do MIME mail creation include metamail, Heirloom mailx, and mutt. 2. The sent e-mail will include the target fax number in the recipient address. This part might be done (in part) on the Postfix side, by using recipient_delimiter and the fax number as ${extension}. Perhaps that's the Postfix piece you've missed? 3. The subject of the e-mail will be used as the subject on the fax cover page. 4. The body of the e-mail will be used as the comments on the fax cover page. The body will be text only, font is irrelevant. Currently, I can use a simple pipe transport to the faxmail utility, as: faxunix-nn-1pipe flags= user=fax argv=/usr/bin/faxmail -N -T -d ${user} This obtains the destination fax number from the mail recipient, and passes along the message for processing. However, because of how faxmail processes the mail, it results in the following: 1. The body of the email does not appear in the cover page. I'm thinking you'd want a preprocessing script which will do the MIME detachments, and save the message text in a temporary file (from which to generate the cover page.) I'm not sure which of the above-named tools would be best/easiest for this project, but one or more of them should be able to do it. 2. An intermediate fax page is generated (between the cover page and the attachments) that contains anything present in the mail body, plus some headers. I didn't know if there was a Postfix facility, or a known third-party tool, that could take an e-mail message, and strip off everything EXCEPT the attachments. Similarly, if there was a tool that could extract the clean body of the message without attachments or headers. I think you'll also want your preprocessor to do some basic sanity checks, because users are users, and they will at some point fail to follow the instructions they were given. You'll want to send them a message telling them that their fax wasn't sent and why, and repeat the instructions (or link them to a Web page explaining it.) -- Offlist mail to this address is discarded unless /dev/rob0 or not-spam is in Subject: header
Fax Gateway Usage with Hylafax
I'm trying to implement an email-to-fax gateway using Postfix + Hylafax. Hylafax's provide faxmail command does function - but it doesn't accomplish what I want. In particular, I would like to: 1. Send an e-mail with one or more attachments intended for faxing. The attachments will already be in hylafax-recognizable format (postscript, pdf, or tiff). 2. The sent e-mail will include the target fax number in the recipient address. 3. The subject of the e-mail will be used as the subject on the fax cover page. 4. The body of the e-mail will be used as the comments on the fax cover page. The body will be text only, font is irrelevant. Currently, I can use a simple pipe transport to the faxmail utility, as: faxunix-nn-1pipe flags= user=fax argv=/usr/bin/faxmail -N -T -d ${user} This obtains the destination fax number from the mail recipient, and passes along the message for processing. However, because of how faxmail processes the mail, it results in the following: 1. The body of the email does not appear in the cover page. 2. An intermediate fax page is generated (between the cover page and the attachments) that contains anything present in the mail body, plus some headers. I didn't know if there was a Postfix facility, or a known third-party tool, that could take an e-mail message, and strip off everything EXCEPT the attachments. Similarly, if there was a tool that could extract the clean body of the message without attachments or headers. -- Daniel