notify

Top  Previous  Next

The notify object can be used to send messages to email addresses, users who have email addresses, or DocFlow role members who have email addresses.  The object works with the notify.ini file (and notify.custom.ini) to generate email subject and message bodies based on named templates.  Data can be supplied to replace expressions within the templates at the time a message is sent.

 

Note that notify.ini is replaced by updates, and as shipped contains sample notification settings.  For user-defined notifications, create notify.custom.ini in the UnForm server installation directory.

 

The format of each section of notify.ini and notify.custom.ini is:

 

[msgid]

# comment

name=value

name2=value2

...

message line 1

message line 2

...

 

Comments are ignored.  The first line that is not a name=value format begins the message content.  Specific names that are important are subject, mimetype, cc, and bcc.  All values and message lines support embedded expressions in the format {name$} (note the $ suffix is required in the expression), and they will be replaced with the value, from the list of names in the section, or of more benefit, name-value pairs supplied in a data$ argument. Data$ can be either a string template or a line-feed delimited list of name=value pairs.  For name=value pairs, the name doesn't require a $ suffix, though it is allowed.  For string template-based expressions, you can specify the base variable name or data.name$ in expressions.

 

You can also use object properties and methods from the doc object, if it has been assigned.  Properties are referenced as {doc'propertyname$} for string properties, or {str(doc'propertyname)} for numeric properties.  A method is invoked using parentheses, such as {doc'geturl$()}.

 

Note that when sending HTML email, data values may need to be entity-encoded if they will appear in message body content.  If required, you can use the entityencode() function as part of the expression syntax: {entityencode(name$)} for example.

 

Emailing requires configuration of SMTP email settings in the server manager or configuration files.

 

notify=new("notify"[,object])

 

 

Properties

 

doc is a object, initially assigned by the optional 'object' argument during instantiation, or set to an object identifier before executing any of the emailing methods.  This object is typically a inbounddoc or docflowdoc object, and named based on this assumption, but it in fact can be any object with properties.

lasterrmsg$ contains an error message if any of the methods fails.

 

Methods

 

email(to$,msgid$[,data$[,cc$[,bcc$[,attachfile$]]]]) sends an email to the to$ address specified (multiples separated by commas).  The notify.ini section specifed by msgid$ is used to create the email content.  The data$ argument can be a string template or a linefeed-delimited list of name=value pairs.  Each template variable or name can be referenced in an embedded string expression {name$} in the section's values and message content.  If supplied, attachfile$ should contain the name of a file to attach to the email, typically a PDF or image file.

emailuser(userid$,msgid$[,data$[,cc$[,bcc$[,attachfile$]]]]) sends an email to the named UnForm user, as long as that user has an email address configured.

emailrole(roleid$,msgid$[,data$[,cc$[,bcc$[,attachfile$]]]]) sends an email to the notify-enabled users in the DocFlow role specified, as long as each user has an email address configured.