Customizing E-Mail Processing
By default, the SMTP gateway generates FS files that send a fax to the phone number specified in the recipient address. For example, if the gateway receives a message addressed to email@example.com it will generate an FS file to send a fax to the number 630-778-8848. The fax will consist of the email message body and whatever attachments were included with the message provided the attachments are faxable or one of the formats supported by the document converter. The FS files generated by the gateway contain the basic set of commands required to send a fax and some additional variable definitions that contain data from the message. The commands generated by the gateway include $fax_origin, $fax_sender (sender's name or email address), $fax_user (from gateway configuration), $fax_status1, $fax_status2, $fax_phone (from recipient address), $fax_receiver (recipient name), $fax_cover (from the default cover sheet in the gateway configuration), and $fax_filename commands for the email message body and attachments.
You may customize the fax processing done by the gateway using sender templates that contain additional FS file commands or commands that override those generated by the gateway. You may also use sender or recipient templates to specify the creation of a worker box instead of the normal fax transmission FS file. Worker boxes are special FS files that launch a CopiaFacts script instead of sending a fax. Scripts may call external programs and custom DLLs, perform database queries and updates, and perform calculations, comparisons, and data manipulation using scripting language commands. This feature allows you to trigger a custom process whenever an email is sent to a particular mailbox or received from a particular sender. This custom process has access to all of the data contained in the email message. You can cause a worker box to be generated by placing a $worker_box command in the sender template.
Recipient templates must have a $worker_box command since recipient templates can only be used to launch worker box processing. Recipient templates allow you to use the gateway to perform custom processing when an email is received to a specific mail box. For example, you could set up a recipient template named remove.fst that would be used to process email sent to firstname.lastname@example.org. You could publish this address on your web site and include it in the email that you send out to allow people to remove themselves from your subscriber lists. When the gateway receives a message sent to remove, it would use the recipient template to create an FS file to launch a script that updates your subscriber database.
Sender templates must have a $worker_box command when recipient list creation is specified. Recipient lists may be created using either comma-separated or tab-separated values. Each entry in the list includes the fax number (or email address in some cases), the recipient name if available, and the recipient type (TO, CC, or BCC). Recipient lists are suitable for use with the CopiaFacts Job Administration or the CopiaFacts Broadcast Launcher. These programs accept lists in other formats as well and may be launched using a command line or DLL. However, a script is required to launch the program since the gateway makes no assumptions about how the recipient list will be used.