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: > fax unix - n n - 1 pipe > 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