Recipient templates provide a way to process email messages sent to a specific mailbox. You could use recipient templates to automatically process email list removal requests, requests for product literature via email, order processing, setting up your own SMS gateway, setting up a custom filter for your own email, or just about any process you can think of. Recipient templates must use the worker box command that is optional for sender templates. The $worker_box command may be used to launch CopiaFacts scripts, which in turn can run external programs, interface to custom DLLs, perform database queries and updates, and perform comparisons and calculations along with a number of other functions.

Recipient templates must be defined within a domain assigned to the gateway. If your gateway domain is fax.xyzcorp.com, then recipient templates should be defined within the folder fax.xyzcorp.com created for this domain. If email addressed to another domain is also sent to the gateway, you may need to define a domain and recipient mailboxes to handle those messages as well. Remember that the gateway accepts all messages that it receives, regardless of the destination domain unless you restrict the recipient domains and/or senders. It rejects messages not sent to fax number mailboxes unless a mailbox is defined for that recipient. The fax number portion of the mailbox may contain punctuation such as dots, parentheses, dashes, and plus signs. All punctuation is stripped from the fax number with the exception of the vertical brace character (|), which is used to perform DTMF dialing after connection. This is described more fully under $fax_phone.

Recipient templates take precedence over sender templates. That means that if a recipient template exists for a recipient then that template will control the processing of the message for that recipient. Sender templates may still be used to perform sender validation and to provide some customization when email is sent to a mailbox identified by a special recipient. However, only the commands from the recipient template will be used to generate the FS file. The gateway examines each incoming email message recipient to determine if the recipient has a corresponding recipient template. Like sender templates, recipient templates are stored under recipient domain folders in the sender/recipient templates folder.  The recipient template names should match the mailbox name (without the domain portion) and have a file extension of .FST. Mailbox names may be numeric or alphanumeric so it is possible to set up special recipients for special fax numbers. Since the gateway looks for recipient templates before attempting to use the mailbox name as a fax number, you may have special recipient fax numbers for custom processing. You may also specify an option in the recipient template to require that the sender be validated in order to send to the special recipient. This offers you another level of security in processing the email messages.

You may also create special recipient templates that handle email for multiple recipients. You do this by providing a list of wildcard mailbox names and the name(s) of the recipient template(s) that will handle mail sent to mailboxes matching the wildcard specification(s). You could use this feature to handle responses to and/or bouncebacks from email marketing campaigns by specifying unique reply-to addresses for each recipient in the campaign broadcast. The bouncebacks and replies from the email broadcast would be sent back to the unique reply-to address, but would be processed by the single script associated with the special recipient template that handles your email campaign responses. You would be able to associate the response with the original email using the unique reply-to address. You can also use this feature to place unique email contact addresses in various web marketing pieces to track web campaigns and to provide automated follow-up with your customers.

There is also a global default recipient template that may be used as sort of a catch-all to handle any email message that the gateway receives that is not addressed to a fax number or a recognized mailbox. The global default recipient may also be restricted to recognized senders. You might use the global default recipient to forward these messages to an email address where they can be examined and routed accordingly. The global default recipient template is named RECIPIENT.FST and should be located in the DEFAULT folder under the sender/recipient templates folder.

Recipient templates may be maintained within the gateway manager application (see Working with Templates) or separately using COPIAEDIT and/or Windows utilities such as Notepad or Wordpad. We recommend not using Notepad or Wordpad if you select a Unicode encoding for FS and FST files.  The templates are plain text files containing valid FS file commands. COPIAEDIT allows you to edit any CopiaFacts configuration or command file and provides a hot link to the appropriate topic in this file for help with the commands.