Custom Web Publishing Guide

Table Of Contents
62 Custom Web Publishing Guide
1 The individual values for the smtpFields parameter, such as the subject, must be a URL-encoded string. For
example, the “&” character must be specified as “&” and blank spaces must be specified as “%20”.
The entire string for the
smtpFields parameter must be XML-encoded. (See the example at the end of this
section.)
1 For each of these functions, a value of true() is returned if the email message is successfully sent; otherwise
false() is returned.
1 For English email messages, the Web Publishing Engine uses an initial default text encoding of ISO-8859-
1. You can change this setting by using the Administration Console. See the
FileMaker Server Advanced
Web Publishing Installation Guide
.
1 The fmxslt:send_email(String smtpFields, String xsltFile, Node xml, boolean includeImages) function sends an
email message consisting of XML data that is processed by the email stylesheet you specify in this function.
1 For the xsltFile parameter, specify the name of the email stylesheet by entering a URL that is relative to
the main processing stylesheet file for the request.
1 For the xml parameter, specify the parent node of the XML data that you want to use with the email
stylesheet. To send an email message using the same XML data that is being displayed in the browser,
simply provide the XPath for the root of the document: “/”. Otherwise, you can use a different XML
document by first loading it with the
document() function, and then passing that document into the
fmxslt:send_email() function.
1 For the includeImages parameter, specify a boolean value of true() to have the Web Publishing Engine
include all images specified in the HTML of the email message as attachments. This parameter includes
both FileMaker database images as well as non-database images from other locations. The Web
Publishing Engine changes the image URLs to refer to the attachments. Performance can be slow if the
image files are numerous or large. If you specify
false (), the Web Publishing Engine does not change the
URLs for the images. If the URLs are absolute, the email client will attempt to load the images from the
web server.
Here is an example of using the fmxslt:send_email(String smtpFields, String xsltFile, Node xml, boolean
includeImages)
function inside an XPath statement, such as inside the <xsl:if> element:
fmxslt:send_email('tom_jones@company.com?subject=project%20status&amp;from=john_smith@company.com&amp;
cc=jane_doe@company.com','my_mail_template.xsl', /, true())
For information about configuring the Web Publishing Engine to connect to a SMTP server, see the FileMaker
Server Advanced Web Publishing Installation Guide
.
Using the header functions
You can use the fmxslt:get_header() function to read information from the HTTP request and response headers,
and the
fmxslt:set_header() function to write information to the headers. These functions are useful if the client
can use the header information to retrieve information from the web server, or if you need to set a HTTP header
for other reasons.
Header extension function Data type returned Description
fmxslt:get_header(String name) string Returns the specified header value
fmxslt:set_header(String name, String value) void Sets the specified header value
fmxslt:set_status_code(Number status-code) void Sets the HTTP status code