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

Reply via email to