sendEmail(file, template, receiver, subject, message) Last updated: 30. May 2026

API only function

Produces a file using the specified template (HTML, PDF etc) and sends the output by email.

Parameters

Name Type Description
file string

Absolute path to file.

template string

Name of the template to use to generate this file's output.

receiver string (email)

To address for the email.

subject string

Subject for the email.

message string

Message for the email.

Returns

Returns true if successful otherwise an error message.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Generate a PDF and send it
docly.sendEmail(
    "somefile", 
    "Contract.html.pdf", 
    "test@docly.net", 
    "Contract for rental", 
    "Here is the signed contract attached. See you soon!");