/* Purpose: PMM2FAX will locate the Subject: and From: fields as well as the attachment file name in an email message. This information is then used to call FxRcv.exe (which comes with PMfax) so the FAXes can be logged with a subject and name attached to them. When used with a PMMail/2 filter, this program will allow automatic reception of FAXes by email. Limitations: PMM2FAX can only receive and log one FAX attachment per message Note: This script was tested only with PMfax but may also work with FaxWorks for OS/2. Installation/Usage: 1) Enter the full path to the PMfax directory (where FxRcv.exe and all your faxes are stored) in the appropriate location below 2) Place this file (PMM2FAX.CMD) in a directory somewhere on your hard disk (you have most likely already done this if you're reading this file) 3) set up a "Simple" filter in PMMail/2 to do the following: a) Search the field for ".FAX" (without the quotation marks) -Or- (select the "Or" connective from the drop-down list) b) Search the Subject: field for "EMAIL FAX" c) In the first "Actions" drop-down list select "Save attachments to directory" d) In the resulting entryfield, enter the full path to your PMfax directory (the same one you entered below as instructed in step #1 e) In the first "Actions" drop-down list select "User hook (background)" f) In the resulting entryfield, enter the full path to this file g) Make sure you click the "Enabled" and "Incoming" checkboxes! Please send comments, bug reports and suggestions to trevor@haligonian.com */ /* get the name of the email message from PMMail/2 */ Arg InputFileName /* Enter the full path to the directory on your hard disk containing PMfax and FxRcv.exe here */ FaxReceiveDir = "E:\PMfax\" /* set the other defualt values */ FromID = "" Subject = "" FaxFileName = "" /* start reading through the email message */ Do while Lines(InputFileName) Line = Linein(InputFileName) Parse var Line Header Rest Select When (Header = "From:") & (FromID = "") then do /* This is the "From:" line from the email header so... */ Parse var Rest '"' Name '" <' Address '>' FromID = Name || ' (' || Address || ')' /* switched the < and > to ( and ) above because FxRcv doesn't like < and > */ Say FromID end /* when then do */ When (Header = "Subject:") & (Subject = "") then do /* This is the "Subject:" line from the email header so... */ Subject = Rest Say Subject end /* when then do */ When (Header = "Content-Type:") & (FaxFileName = "") & (Pos('name="',Rest) > 0) & (Pos('.FAX"',Rest) > 0) then do /* This is very likely an attachment containing a FAX so... */ Parse var Rest LeadingChars 'name="' FaxFileName '"' TrailingChars Say FaxFileName end /* when then do */ Otherwise /* we're ignoring every other line in the email so... */ nop end /* select */ end /* do while */ /* Now that we've found the Subject, Sender and attachment file name, we call FxRcv.exe */ FaxReceiveDir || 'FxRcv -rcvd ' || FaxReceiveDir || FaxFileName '"' || FromID || '"' '"' || Subject || '"' EXIT /* end REXX script */