The sender templates validation option allows the use of fax broadcast type templates to both validate senders and to provide additional fax customization or alternative processing of the email message based upon sender and domain. When this option is selected, the gateway parses the sender's email address into the sender's mailbox name and domain. It then checks for the presence of a folder corresponding to the sender's domain and a template file corresponding to the sender's mailbox. The domain folder must be located in the folder specified in the Sender/Recipients Templates section at the bottom of the validation section tab. If the domain folder is not found, the email is rejected and the sender receives an SMTP 500 error message. If the domain folder is present, then the gateway searches it for the presence of a template file for the sender. The template file has the same file extension (.FST) as the fax broadcast templates and may contain any valid FS (fax send) file commands. If no template file is found for this sender, the gateway checks the domain folder for a file named DEFAULT.FST, which is the default sender template for the domain. This template is optional and allows email to be received from any senders from the specified domain. The default template will then be used to provide additional FS file commands for these senders. If there is no default sender template and no matching sender template, the email will be rejected with an SMTP 500 error message.
You may also use sender templates without validating senders. The gateway will always use a sender template to provide additional customization capabilities for individual senders if a matching or default sender template is found. You may also specify a global default sender template to be used when no matching sender template or default template for the sender domain is found. Generally you would not use a default global sender template unless you wished to perform custom processing for email sent to the gateway that could not be validated against existing senders. You could provide a custom script for unrecognized senders that forwards email from these senders to an administrator for evaluation and further action. You also have the ability to restrict individual senders from using the gateway to send fax messages.
Some earlier releases of the gateway required a global default sender when sender validation was required in order to handle special email such as remove requests that could be sent from anyone. Now, anyone may send email to special mailboxes unless the mailbox is specifically restricted to valid senders. Email addressed to these special recipient mailboxes no longer uses global notification options either.
The global default sender template is named SENDER.FST and should be located in a folder named DEFAULT located in the sender/recipients template folder along with the other domain folders. You should be extremely cautious about providing such capability when your gateway is open to the Internet to avoid spam. We recommend using the option flags to restrict fax operations for the global default sender or using the worker box option to completely control the processing of email messages allowed under the global default sender.
Sender 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 have 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.
The Template DLL
To avoid the need to maintain a large number of sender templates, larger users may write a DLL to give full dynamic control over the template without the need for separate files. This DLL can use whatever sources are convenient to validate senders. The DLL path name must be supplied as the value of a FAXFACTS.CFG variable TEMPLATE_DLL_PATH, and you may also specify, as TEMPLATE_DLL_BUFFER_SIZE (default 2048 Unicode characters), the maximum size of the template text you will return from the DLL.
The DLL is passed the recipient domain, the sender From: address, and the sender IP. It can return -1 to reject the message, 1 to accept the message and use the passed template text instead of looking for a sender template file, or zero to accept the message if it there is a normal sender template for it.
C prototypes and entry points:
typedef int (*TREAD)(wchar_t *, wchar_t *, wchar_t *, int);
typedef int (*TREADEX)(wchar_t *, wchar_t *, wchar_t *, wchar_t *,int);
The first parameter is a null-terminated wide-character array containing the recipient domain name.
The second parameter is a null-terminated wide-character array containing the sender e-mail address.
The third parameter for TemplateReadEx only is a null-terminated wide-character array containing the sender IP address.
The last wide-char parameter is a wide-character buffer provided for the DLL to return the FST template contents, null-terminated. Any valid Unicode data can be returned.
The last parameter is the size of the buffer in wide characters, obtained from the variable TEMPLATE_DLL_BUFFER_SIZE.
The FST template format should be a single string containing one or more lines of text, each line terminated with a carriage-return / line-feed pair of characters.
It is important to note that the entry point may be called concurrently from multiple threads in the Gateway. It is operating in a service environment so may not have access to the shares and drive mappings of any specific user.
The returned template text is saved in the .MIF file for use by the thread that processes incoming messages after receipt.
The next topic describes the use of Recipient Templates.