The SMTP server through which your company sends emails can also be configured via the REST API. This is done using the address /c/{firma}/nastaveni/smtp, where {firma} is the company's database identifier.
Prerequisites
To configure the SMTP server, the user must have the ADMIN role with the server permission Access all companies. The same setting can be found in the desktop application under Tools → SMTP Server Settings.
Saving the settings
Save the settings using the POST or PUT method with the following XML in the request body:
<nastaveni-smtp>
<!-- Adresa serveru -->
<host>vzor.seznam.cz</host>
<!-- Port serveru -->
<port>465</port>
<!-- Uživatel -->
<username>vzor@seznam.cz</username>
<!-- Heslo -->
<password>tajnehelso</password>
<!-- Výchozí odesílatel -->
<defaultFrom>Jméno Odesílatele <vzor@seznam.cz></defaultFrom>
<!-- Zabezpečení spojení -->
<encryptionMode>SSL</encryptionMode>
</nastaveni-smtp>
Field | Meaning |
| Address of your own or an external SMTP server |
| SMTP server port, for example 465 or 587 |
| Username, typically an email address. Required if the SMTP server requires authentication. |
| Password for the specified user. Required if the SMTP server requires authentication. |
| Default sender. You may include the sender's name or provide just the email address. If a name is included, it must be enclosed in angle brackets, which must be encoded in XML as |
| SMTP communication security mode, for example |
The response is an updated record:
<?xml version="1.0" encoding="utf-8"?>
<winstrom version="1.0">
<success>true</success>
<stats>
<created>0</created>
<updated>1</updated>
<deleted>0</deleted>
<skipped>0</skipped>
<failed>0</failed>
</stats>
<results></results>
</winstrom>
Reading the settings
You can read the saved settings using the GET method. Instead of the password, you will only receive a flag indicating whether it is set:
GET https://demo.flexibee.eu/c/demo/nastaveni/smtp.xml
<?xml version="1.0" ?>
<nastaveni-smtp>
<defaultFrom>vzor@seznam.cz</defaultFrom>
<encryptionMode>SSL</encryptionMode>
<host>smtp.seznam.cz</host>
<password filled="true"></password>
<port>465</port>
<username>vzor@seznam.cz</username>
</nastaveni-smtp>
ℹ️ If the SMTP server has not yet been configured for the company, GET will return the status code 404 with the message "SMTP server is not configured" and the code smtpSeverNotSet. This is not a call error — it's just information that the configuration is missing.
⚠️ Be sure to include the extension .xml or .json (or alternatively send the Accept header). Without it, the server will return the error as an HTML page and you won't get a structured message.
Sending a test email
You can verify that the settings work by sending a test email — using the GET method with the testMail parameter, in which you specify the recipient's address:
GET https://demo.flexibee.eu/c/demo/nastaveni/smtp.xml?testMail=adresat@testu.cz
The following message will appear in the recipient's mailbox:
Předmět: Testovací email
Testovací email ze systému ABRA Flexi.
⚠️ This call actually sends an email to the specified address. Therefore, use it with your own address, not a customer's address.
Failed requests
1. Incorrectly specified port
For an invalid port, the response is:
<message>java.lang.IllegalArgumentException: port out of range:4651111</message>
2. Default sender in an incorrect format
If defaultFrom does not contain a valid email, or the name is not separated by angle brackets:
<message>Výchozí odesílatel musí obsahovat jednu adresu ve tvaru 'Jméno Příjmení <uzivatel@domena.cz>' nebo 'uzivatel@domena.cz'.</message>
3. Test email cannot be sent
If the SMTP settings are incorrect and the test email is not sent:
<message>com.sun.mail.util.MailConnectException: Couldn't connect to host, port: vzor.seznam.cz, 465; timeout 30000; nested exception is:
java.net.UnknownHostException: vzor.seznam.cz
Couldn't connect to host, port: vzor.seznam.cz, 465; timeout 30000
vzor.seznam.cz</message>
FAQ
How do I configure SMTP in the application?
You can find the procedure in the articles SMTP Server Setup for the desktop application and SMTP Server Setup in the Web Interface.
Setting up Google SMTP returns an error — what should I do?
Solutions are described in the articles Setting up Google SMTP in the application returns an error and Setting up Google SMTP for sending emails from the application.
How can I send documents or payslips via SMTP?
This is handled by the services described in the articles Sending documents by email - REST API and Sending payslips via SMTP.

