Smtp Adapter

Smtp Adapter

Functionality

The SMTP Adapter allows you to send an e-mail; this is particularly interesting to add password-reset functionality in the workflow.

Prerequisites

The adapter requires an SMTP-server.

Configuration

AdapterUniqueID

Unique name assigned to this adapter; the name is used to reference the adapter in the workflow. The ID has following requirements:

  • START with a letter or _ (underscore)
  • FOLLOWED by a combination of following characters: Letter, Number, '.' (dot), '-' (dash), '_' (underscore)
  • Port Port of your mailserver to send mail to (mandatory)
  • JndiName The JNDI name of the mail session if you use a mail server application (mandatory if you use an application)
  • Host Host address of your mailserver (mandatory)
  • Password Password to autenticate
  • User Username to authenticate

Workflow Settings

A request for the adapter is prepared by specifying the following properties/scripts in the adapter activity:

  • Input Property: the variable containing the instructions the adapter have to execute
  • Output Property: the variable the adapter will store the response in after execution
  • Before Adapter Script: script that will be executed before calling the adapter
  • After Adapter Script: script that will be executed after the adapter fulfilled its task

Request - API

smtpRequest

var sms = tb.smppRequest({
    from : "+32477777777",         
    to : "+32477777777",
    msg: 'my sms'
    ,predefinedMsg: 1 /*optional*/
    ,numberingPlanIndicator: 1 /* optional number */
    ,typeOfNumber: 1 /* optional number */
})

where "mailoptions" contain:

  • To: Recipient of the mail
  • From: Sender of the mail
  • CC: Recipients in carbon copy
  • BCC: Recipients in blind carboncopy
  • Subject: Subject of the mail
  • Body: Plain text body
  • Html : Html body
  • Parts: a list of attachments

Response - API

Common Properties

The response API can be applied to the variable specified in the "output property" (see "Workflow Settings"): to verify whether the action performed by the adapter was successful, to query for the data returned by the adapter.

All responses have four properties in common:

  • status Status flag indicating whether the response is ok (0) or not (1).
  • substatus Response specific number indicating what the problem was, eg. http status code
  • message Response specific message in case there was a problem (can be null)
  • rc Return Code, a human readable code based on the substatus

Response Codes

If all is ok, the status is zero, for non-zero statusses you can find the description below.

  • 1 Invalid Address
  • 2 No such provider The application server doesn't support an SMTP provider
  • 3 Messaging problem

Examples

Request

function sendsms(workItem){
    var options = {
        from : 32499123456,
        to : 32499654321,
        msg : "Hello World!",
        numberingPlanIndicator : 1,
        typeOfNumber : 1
    };

    workItem.smsIn = tb.smppRequest(options);
}

Response

if (status == 0) {
    log("status: good");
    //sms was send
}
Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.