OpenWGA 7.11 - TMLScript reference

WGA
Method :

WGA.createMail([host, username, password])
WGA.createMail(config)

On object WGA
Usage Creates a Mail object for sending e-mails
Description

By parameter you can explicitly set a SMTP server, plus username and password for login, which should be used for sending e-mails. If you omit these parameters WGA uses the mail configuration of the OpenWGA server.

For backward compatibility there still is a method "createMail()" available on TMLContext whose use is discouraged since OpenWGA 5.3.

Parameters

Variant 1 (3 paramaters)

host (String, optional):

The hostname of the SMTP server used to send e-mails

username (String, optional)

The username to login to the SMTP server

password (String, optional)

The password to login to the SMTP server

Variant 2 (single config parameter)

config - Java.Map or JavaScript object

This variant assumes all mail parameters be contained in a single map object. Allowed keys are

    • from (String - defaults to OpenWGA server config settings)
    • to (String or Array of Strings)
    • cc (String or Array of Strings)
    • bcc (String or Array of Strings)
    • encode (boolean - defaults to true)
    • subject (String)
    • body (String)

Return value A new Mail object
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples

WGA.createMail({  
    to: "my@address.com",
    subject: "Test",
    body: "My Body ..."
}).send();