Skip to main content

Sending via email together with saving the attachment

PDF is not attached to the sent document in the records — how to save it separately

Written by Petr Pech

A document can be sent by e-mail via the API together with a PDF attachment. However, this attachment is not saved with the document — it is generated only for the purposes of the sent e-mail.


Sending the Document

PUT /c/{firma}/faktura-vydana/123/odeslani-dokladu.xml?to=prijemce@example.com&subject=Faktura

Request parameters:

Parameter

Meaning

to

Recipient; can be specified multiple times.

cc

Copy; can be specified multiple times.

subject

E-mail subject.

sablona

Custom e-mail template from the sablona-mail records.

report-lang

Language of the PDF attachment.

At least one recipient must be specified — otherwise the request will fail with error 400. The request body may contain the e-mail text in UTF-8. The PDF (and optionally ISDOC) will be attached automatically.

ℹ️ After sending, the document's attachment list remains empty — the generated PDF is not saved anywhere. If you need to keep it with the document, save it separately: first download it (/123.pdf) and then upload it as an attachment, see How to save a PDF to a document via the API?.


Prerequisite

Sending only works on a server with SMTP configured (smtp.host, smtp.defaultFrom, and optionally login credentials). For a self-hosted installation, this is a matter of server configuration; in the cloud, it is a setting that support can help you with.


Related

Did this answer your question?