Docly Developers
Function API only Updated 23 Oct 2026

sendForm(form, subject, [options])

Sends a submitted form by email from an API function.

Parameters

formobjectrequired

Object where each property becomes a row in the email, in the same order as defined in the object. Only plain text is supported — HTML will not be rendered. Line breaks (\n) are preserved, so you can format the content using line breaks and UTF symbols (e.g. ✓, →, •).

subjectstringrequired

Subject of email, prefixed with "FORM: " if subjectPrefix is left out.

optionsobjectoptional
Specify any of the following options parameters:
sendToemail(s)

One or multiple emails to send to (csv or array). If not specified, the email goes to the workspace owner. An invalid address throws error 7; no valid recipient at all throws error 6.

smtpstring

Path to an SMTP configuration document, for example "#/My Smtp", where you set the sender address and server. Throws error 2 if the document is not found.

subjectPrefixstring

Custom prefix for the subject line. If left out, "FORM: " is used. Passing null or an empty string sends the subject without a prefix.

addSenderInfobool

If true, the sender's country (from the IP address) and device/browser are included in the email. The IP address itself is not included — the recipient is not the sender. Default true.

descriptionstring

Sub header text for the email body. Default: "You have received a submission from an online form:".

attachmentsobject[]

An array of objects with property "Filename" and "Data".
Filename - name of file.
Data - array of bytes or base64 encoded string.

sendToCcemail(s)

One or multiple emails to send as CC (csv or array).

sendToBccemail(s)

One or multiple emails to send as BCC (csv or array).

Returns

true if successful. Throws an error if sending fails, for example error 3–5 for an invalid attachment.

The email is sent through Docly's mail service. It has a monthly limit per subscription (when the subscription sets one), a daily limit per site and a per-minute rate limit. When a limit is reached the call throws error 8 ("E-mail limit for this site has been reached. The message was not sent."). With your own SMTP configuration the limit does not apply.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
let form = {
    "Message" : "This is just an example",
    "Link" : "https://docly.org"
};
docly.sendForm(form, "Contact form", { sendTo: "test@docly.net" });