caf_smtp/proxy_smtp

Proxy that allows a CA to send email.

Source:

Extends

Methods

dirtySend(to, subject, body) → {Promise.<Object>}

Source:

Blocking email send.

There is no checkpointing for this action, and this call may never be executed if, e.g., the server fails.

Parameters:
Name Type Description
to string

A destination email address.

subject string

A subject line.

body string

The message body (html expected).

Returns:

A promise that we can await to block further message processing. The promise is rejected with an if the message cannot be sent.

Type
Promise.<Object>

instantiateTemplate(templateName, props) → {string}

Source:

Instantiates a preloaded mustache template with some properties.

Parameters:
Name Type Description
templateName string

The name of the preloaded template.

props Object

The properties to instantiate the template.

Throws:

When template not found.

Type
Error
Returns:

The instantiated template.

Type
string

send(to, subject, body) → {string}

Source:

Non-Blocking email send.

The action is checkpointed first, executing at least once. Calls do not block message processing for this CA, and responses can be arbitrarily interleaved with new requests.

The result of this operation is processed in a separate message with the handle method previously set by setHandleReplyMethod.

A unique id is returned to match responses.

Parameters:
Name Type Description
to string

A destination email address.

subject string

A subject line.

body string

The message body (html expected).

Returns:

A unique identifier to match replies for this request.

Type
string

setHandleReplyMethod(methodName)

Source:

Sets the name of the method in this CA that will process reply send messages.

The type of the method is async function(requestId, response)

where:

  • requestId: is an unique identifier to match the request.
  • response is a tuple using the standard [Error, jsonType] Caf.js convention.
Parameters:
Name Type Description
methodName string | null

The name of this CA's method that process replies.