HTMLMailProcess

Top  Previous 

HTMLMailProcess is designed to be used in Process Management framework. You should be familiar with Process Management framework in order to use TextMailProcess element efficiently.

Using HTMLMailProcess element you can send HTML mails with dynamic content to the mail recipients. Place the element into a ProcessBlock or ProcessForm Element and set its properties.

 

HTMLMailProcess_pe
 

Properties

SMTP Account

The sender of the mails.

To, CC, BCC (Accepts MScript)

These are the standard parameters that define the mail recipients.

Subject (Accepts MScript)

You can either enter the text of the mail subject directly into this parameter or specify the reserved symbol "TITLE_OF_TEMPLATE" to instruct the process broker to take it from the Title property of the page that will be sent as HTML mail.

Template Page (Accepts MScript)

Specify the name of the MoreMotion Page which was prepared as a HTML mail. A Template page can be a static or a dynamic page. The static template pages (HTML pages) are sent to the recipients as they are, but the dynamic pages (XSL pages) are first converted to HTML by performing a server side XSLT processing. The XML data required for the XSLT processing are obtained from the fields specified in Fields to Include parameter.

Note:

Set the Base Href Property of the mail page if it contains external sources like image files or external javascripts. The Base Href Property should contain the full URL of the web site where the external sources are located.

Example: http://www.mycomp.com

XML Content (Comma separated symbols) (Accepts MScript)

If the mail template is dynamic, which means is an XSL page, then you should specify the symbols that will provide the XML data. The symbols that can be specified here is as follows:

1.Process Record Fields. Example: f:Name
2.Input Fields. Example: i:Stock
3.Pool Variables. Example: v:Status

 
You can specify one or more fields of different sort by separating them with commas.

Example: f:Name, i:Stock, v:Status, LastWeekOrders

 

XML Fields:

Please note that a Process Record Field or a Pool Variable can store XML data. A Datasource (ADOM) can be converted to XML and stored in a Process Record Field or in a Pool Variable by the mor > ADOM > ADOMToXMLProcess Element.

Generating XML data out of the values of the specified fields:

It is important to know the structure of the XML data created in order to successfully bind the XML nodes to element properties when developing the HTML mail page

Assume that the specified fields contain the following values at the time the HTMLMailProcess is executed.

 

f:Name       i:Stock     v:Status    LastWeekOrders

-----------  ---------   ----------  ---------------------------------------

Printer      12          Discounted  <item>

                                       <custid>5</custid>

                                       <qty>5</qty>

                                     </item>

                                     <item>

                                       <custid>33</custid>

                                       <qty>20</qty>

                                     </item>

 
The HTMLMailProcess will create the XML data below prior to the XSLT processing that generates the eventual HTML mail to send.

 

  <root>

    <Name>Printer</Name>

    <Stock>12</Stock>

    <Status>Discounted<Status>

    <LastWeekOrders>

      <item>

        <custid>5</custid>

        <qty>5</qty>

      </item>

      <item>

        <custid>33</custid>

        <qty>20</qty>

      </item>

    </LastWeekOrders>

  </root>

 

 

Attachments (Comma delimited) (Accepts MScript)

One or more file names can be specified in this property (by delimiting them with commas) as mail attachments. The names can be defined relative to the web application root or can be absolute file names.

Syntax:

[attachment-name | ] file-name [, [attachment-name | file-name ] ]
 

attachment-name : 

The name of the attachment that will appear in the e-mail. When this optional parameter is omitted the file-name is used as the attachment name.

 

file-name : 

The name of the file to be attached. It can be an absolute file path or it can be defined relative to the web application root.

A process block field name or a pool variable name can also be given instead of a file name. If this is the case the PB field or pool variable should contain the File Object of the file. Using this feature, for example, a pdf document created and placed in a pool variable as a file object by "mor > Fop > FopProcess" can be attached to the e-mail.

 

Examples:

Definition

Attached Object

Attachment names

in e-mail

a.doc

File "{applroot}/a.doc"

a.doc

c:\data\a.doc, b.pdf

File "c:\data\a.doc" and File "{applroot}/b.pdf"

a.doc, b.pdf

/tmp/docs/a.pdf, b.pdf | docs/000.pdf

File "/tmp/docs/a.pdf" and File "{applroot}/docs/000.pdf"

a.pdf, b.pdf

a.pdf | v:pdf1, b.pdf | /tmp/1.pdf 

File Object in pool variable "pdf1" and File "/tmp/1.pdf"

a.pdf, b.pdf

a.pdf | f:pdf1

File Object in PB Field "pdf1"

a.pdf

Send In

E-mails can be sent in the foreground or in the background. If big amount of the email is expected to be processed then choose the option "2. Background" so that the user is not locked until the all the emails are sent.

Background Thread Quantity

If the choice of the "Send In" property is "2. Background" then this property can be assigned the number of the sender threads to be started in the background. This feature can be used shorten the sending time.

Log File Name (Accepts MScript)

If a log file name is specified in this property the Mailer component writes the log records in it to report successful and unsuccessful sendings. The file can be specified absolute of relative to the root directory of the web application.

Send Status Target Symbol (Accepts MScript)

The symbol defined here will be assigned a status code right after a mail is attempted to be sent. By checking its value the following processes can make decisions.

f:SEND_STATUS is the default target symbol. This property is valid when "Send In" property is "1. Foreground".

The status codes are:
 
00: Send was OK
04: At least one of the recipient addresses was in error.
08: All of the recipient addresses were in error.
 12: Messaging Exception occurred.
 

Completion Codes

This Process returns the following completion code

0 Normal completion
12 A mail related error occurred (invalid SMTP account, etc)