Skip to content

Mail Handler ​

Send an e-mail through a handler configured in the dashboard.

Quick start ​

ts
await window.Portal.mailHandler.send('HANDLER_REF', { recipient: 'a@b.com', name: 'Ada' });

API reference ​

window.Portal.mailHandler ​

Portal.mailHandler — send an e-mail through a handler configured in the dashboard.

get() ​

Reads a handler (and its provider).

ts
const mailHandlerGetResponse = await window.Portal.mailHandler.get(referenceNum);

Parameters

NameTypeRequiredDescription
referenceNumstringYesThe record's reference number.

Returns

Resolves with a PortalMailHandlerGetResponse: The answer to Portal.mailHandler.get().

send() ​

Sends an e-mail with the handler.

ts
const mailHandlerSendResponse = await window.Portal.mailHandler.send(referenceNum, data);

Parameters

NameTypeRequiredDescription
referenceNumstringYesThe record's reference number.
dataPortalMailHandlerSendPayloadYesWhat Portal.mailHandler.send() sends.

Returns

Resolves with a PortalMailHandlerSendResponse: The answer to Portal.mailHandler.send().

Types ​

PortalMailHandler ​

A mail handler: a named e-mail template/route that can be sent to.

NameTypeRequiredDescription
item_reference_numstringYesThe handler's item reference.
namestringNoThe handler's name.
categorystringNoThe handler's category.
[key: string]unknownNoFurther fields the server may add.

PortalMailHandlerGetResponse ​

The answer to Portal.mailHandler.get().

NameTypeRequiredDescription
successbooleanYesTrue when the call worked.
providerPortalMailProviderYesThe provider the handlers send through.
handlersRecord<string, PortalMailHandler>YesThe handlers, keyed by their reference.

PortalMailHandlerSendPayload ​

What Portal.mailHandler.send() sends. Fields beyond recipient are template variables.

NameTypeRequiredDescription
recipientstringYesThe address to send to.
[key: string]unknownNoFurther fields the server may add.

PortalMailHandlerSendResponse ​

The answer to Portal.mailHandler.send().

NameTypeRequiredDescription
successbooleanYesTrue when the e-mail was queued.
providerPortalMailProviderYesThe provider used.
handlersRecord<string, PortalMailHandler>YesThe handlers, keyed by reference.
dataPortalMailHandlerSendPayloadYesWhat was sent.

PortalMailProvider ​

A configured e-mail provider (the account mail is sent through).

NameTypeRequiredDescription
idnumberYesRecord id.
reference_numstringYesThe provider's reference.
ownernumberYesThe member who owns it.
providerstringYesThe provider type, for example 'smtp'.
namestringYesInternal name.
labelstringYesDisplay label.
serverstringYesThe mail server host.
statusnumberYesActive (1) or not (0).
created_atstringNoISO creation time.
updated_atstringNoISO update time.