In the desktop application, the SMTP server can be configured in the menu Tools -> SMTP Server Settings. To access this feature, the user must have the ADMIN role with server rights - Access all companies.
This configuration can also be performed via the REST API. Using the API, the SMTP server can be set at the address: /c/{firma}/nastaveni/smtp, where {firma} is the database company identifier.
The settings can be saved using the HTTP method POST or PUT, with the following parameters in the request body:
host - the address of your own or an external SMTP server.
port - SMTP server port (465, 587, ...)
username - The user's email address. (if the SMTP server requires authentication)
password - The password for the user's email address. (if the SMTP server requires authentication)
defaultFrom - the default sender; following the pattern above, you can include the sender's display name, or leave only the email address.
encryptionMode - The encryption mode for SMTP communication (SSL, TLS, ...)
Usage Examples
1. Saving SMTP settings to ABRA Flexi:
Request body in XML:
<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>
The ABRA Flexi response is then a record update:
<?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>
2. Reading the saved settings is done using the HTTP GET method:
The ABRA Flexi response is then an overview of the SMTP settings:
<?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>
When reading the saved settings using the GET method, instead of the password you will only receive a flag indicating whether it has been filled in: filled=true.
3. Testing the configuration by sending a test email — use the HTTP method GET with the parameter testMail.:
The following email will appear in the mailbox of adresat@testu.cz:
Předmět: Testovací email
Testovací email ze systému ABRA Flexi.
Failed Requests
1. Invalid port
If you enter an invalid port, the API response is:
<message>java.lang.IllegalArgumentException: port out of range:4651111</message>
2. Default sender in an invalid format
If entered without a valid email address, the email must be provided with the characters < and >
<message>Výchozí odesílatel musí obsahovat jednu adresu ve tvaru 'Jméno Příjmení <uzivatel@domena.cz>' nebo 'uzivatel@domena.cz'.</message>
3. Incorrect SMTP configuration — unable to send test email
If the test email cannot be sent, the API response is:
<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
Need help?
If you have any questions about the application, please contact us at podporaflexi@abra.eu or via the chat window in the bottom right corner.

