--- title: Introduction project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/introduction/ updated: 2026-11-19T07:58:04.366Z --- # Introduction > What OpenMail is, what it does and where to start. OpenMail is a small email sender for your other apps. You keep your SMTP servers and your HTML email templates in one place, and your apps send an email with one HTTP request: they name the template, give the recipient and pass the data. OpenMail fills in the template, wraps it in the layout of the profile and sends it through the right SMTP server. OpenMail is an official Total.js app under the MIT license. The code is on [GitHub](https://github.com/totaljs/openmail). ## What you can do - Keep several **SMTP profiles**, for example one per project or per brand, each with its own sender address and SMTP server. - Give every profile an HTML **layout** and as many **templates** as you need, with a live preview while you edit. - Use template markup to put your data into the email and its subject. - Send emails from any app with a REST API and an **API token**. - Add attachments, CC and BCC addresses, and several recipients at once. - Send one template to a list of addresses with **Bulk send**. - See every sent email in **Logs**. - Move profiles and templates between installations with **Export** and **Import**. ## How it fits together 1. You create a profile, for example `Demo project` with the identifier `demo`, and enter its SMTP server. 2. You add a template to it, for example `Welcome` with the identifier `welcome`. Its full identifier is `demo/welcome`. 3. You create an API token for your app. 4. Your app sends `POST /` with the token, `"id": "demo/welcome"`, the recipient and the data. 5. OpenMail renders the email and sends it. ## Where to go next - Install OpenMail: [Install from source](../install-source/). - Protect the admin interface: [First start](../first-start/). - Set up your first [SMTP profile](../smtp-profiles/) and [template](../templates/). - Connect your app: [REST API overview](../../reference/rest-api/). --- title: Install from source project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/install-source/ updated: 2026-11-19T07:58:04.366Z --- # Install from source > Download OpenMail, install its dependency and start it. OpenMail is a Node.js app. You need [Node.js](https://nodejs.org) with npm and, to download the code, Git. ## Download and start **1.** Download the code: ```bash git clone https://github.com/totaljs/openmail.git cd openmail ``` **2.** Install the dependency (the Total.js framework): ```bash npm install ``` **3.** Start the app: ```bash npm start ``` OpenMail listens on port `8000`. Open `http://127.0.0.1:8000/` in your browser: you land on the admin interface at `/setup/`. ## Use another port `npm start` runs `node index.js 8000`. To use another port, start the app with the port number: ```bash node index.js 8080 ``` ## Where your data goes OpenMail keeps everything in the `databases` folder inside the app folder: profiles, templates, tokens, the configuration and the logs. See [Back up your data](../backups/). ## Next step Before you do anything else, set a primary access token: [First start](../first-start/). --- title: First start project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/first-start/ updated: 2026-11-19T07:58:04.366Z --- # First start > Protect the admin interface with a primary access token and find your way around. On the first start, the admin interface at `/setup/` is open to anyone who can reach the server. Protect it right away with a **primary access token**. ![The start screen of OpenMail with Profiles, Tokens and Configuration](/files/JapWJP1fs60f.webp) ## Set the primary access token **1.** Open `http://127.0.0.1:8000/setup/` and click **Configuration**. **2.** Under **Security**, click **Generate** next to **Primary access token**, or type your own token. **3.** Copy the token and keep it in a safe place, for example a password manager. **4.** Click **SUBMIT**. The message "The configuration has been saved successfully, but the app needs to be reloaded." appears. Click **OK**. The app reloads at `/setup/?token=YOUR_TOKEN`. From now on: - `/setup/` without the token answers `401 Unauthorized`. - You open the admin interface at `/setup/?token=YOUR_TOKEN`. - The home page `/` shows only the app name. If you lose the token, see [Reset the primary access token](../../faq/access/). ## Find your way around The icons on the left open the three parts of the app: | Icon | Opens | What you do there | |---|---|---| | Envelope | **Profiles** | [SMTP profiles](../smtp-profiles/), [templates](../templates/), [Logs](../logs/). | | Key | **Tokens** | [API tokens](../api-tokens/) for your apps. | | Cog | **Configuration** | [Name and primary access token](../configuration/). | The book icon opens the online documentation. When you open the admin interface with a token, use these icons to move between the screens. --- title: SMTP profiles project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/smtp-profiles/ updated: 2026-11-19T07:58:06.619Z --- # SMTP profiles > Create a profile with its sender address and SMTP server. A **profile** groups the emails of one project or brand. It holds the sender address, the SMTP server, the [layout](../layout/) and the [templates](../templates/). ![The Profiles screen with the Demo project profile](/files/JapWJi1ws61f.webp) Each card shows how many emails the profile has sent (**Used:**) and when it sent the last one. ## Create a profile **1.** Click the envelope icon on the left to open **Profiles**, then click **Create**. **2.** Fill in the form: | Field | What to enter | |---|---| | **Name** | A name for you, for example `Demo project`. | | **Identifier** | A short code, for example `demo`. Your apps use it in the template identifier `demo/welcome`. | | **Color**, **Icon** | How the card looks in the list. | | **From** | The sender address, for example `noreply@example.com`. Required. | | **Reply to** | The address that receives replies. Optional. | | **BCC** | An address that gets a hidden copy of every email. Optional. | | **Hostname** | The SMTP server, for example `smtp.example.com`. | | **SMTP configuration** | The connection options in JSON, for example the port, user name and password. See [SMTP options](../../reference/smtp-options/). | ![The profile form with the sender addresses and the SMTP server configuration](/files/JapWJk1xs60f.webp) **3.** Click **Test** to check the connection to the SMTP server. See [Test emails](../test-emails/). **4.** Click **SUBMIT**. A new profile starts with a basic HTML layout. Change it in [Profile layout](../layout/). ## Edit, clone or remove a profile Click the cog on a profile card to open its menu: ![The menu of a profile](/files/JapWJm1ys61f.webp) - **Edit** opens the form above. - **Update template** opens the [layout](../layout/) of the profile. - **Clone** makes a copy named `Demo project (CLONED)` with the identifier `demo_cloned` and all its templates. - **Export** downloads the profile as a JSON file. See [Import and export](../import-export/). - **Remove** deletes the profile and its templates after you confirm. Changing the **Identifier** of a profile changes the identifiers of all its templates. Update your apps at the same time. --- title: Profile layout project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/layout/ updated: 2026-11-19T07:58:05.300Z --- # Profile layout > The HTML frame that wraps every email of a profile. Every profile has a **layout**: the HTML around the content of its templates, for example your logo at the top and a footer at the bottom. All templates of the profile use it. ## Edit the layout **1.** Open **Profiles**, click the cog on the profile card and choose **Update template**. **2.** Edit the HTML on the left. The preview on the right updates as you type. **3.** Click **SUBMIT**. ![The layout editor with the HTML on the left and the preview on the right](/files/JapWJY1os61f.webp) ## Where the template goes The layout must contain this line where the template content goes: ```html {{ value | raw }} ``` `raw` inserts the HTML of the template as it is. If you leave this line out, the emails contain only the layout. ## Helpers for all templates A ` ``` Every template of the profile can use them, for example `{{ value.total | amount }}` prints `120.00 €`. See [Template markup](../template-markup/). ## Good to know Email programs support only part of HTML and CSS. Tables and inline `style` attributes, as in the default layout, give the most reliable result. --- title: Templates project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/templates/ updated: 2026-11-19T07:58:07.742Z --- # Templates > Create the emails your apps send, with a subject, an identifier and a group. A **template** is one kind of email, for example a welcome email or an invoice. Every template belongs to a profile and uses its [layout](../layout/). ## Open the templates of a profile Open **Profiles** and click a profile card. You see its templates, sorted by group: ![The templates of the Demo project profile in the groups Accounts and Billing](/files/JapWJt24s61f.webp) Each card shows the full identifier of the template, for example `demo/welcome`, and how many emails it has sent. ## Create a template **1.** Click **Create**. **2.** Fill in the form: | Field | What to enter | |---|---| | **Name** | A name for you, for example `Welcome`. | | **Subject** | The subject of the email. It can contain markup, for example `Welcome, {{ value.name }}`. | | **Identifier** | A short code, for example `welcome`. | | **Group** | Choose a group or type a new one, for example `Accounts`. Optional. | ![The template form with the name, subject, identifier and group](/files/JapWJv25s60f.webp) **3.** Click **SUBMIT**. **4.** Click the new card to write the HTML of the email. See [Template markup](../template-markup/). ## The template identifier Your apps choose a template by its full identifier: the profile identifier, a slash and the template identifier. ```text demo/welcome ``` ## The template menu Click the cog on a template card: ![The menu of a template](/files/JapWJx26s61f.webp) - **Edit** changes the name, subject, identifier and group. - **Update template** opens the HTML editor, the same as clicking the card. - **Bulk send** sends the template to a list of addresses. See [Bulk send](../bulk-send/). - **Clone** makes a copy named `Welcome (CLONED)` with the identifier `welcome_cloned`. - **Export** downloads the template as a JSON file. See [Import and export](../import-export/). - **Remove** deletes the template after you confirm. --- title: Template markup project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/template-markup/ updated: 2026-11-19T07:58:07.018Z --- # Template markup > Put your data into the email with markup, a sample model, helpers and images. The HTML of a template uses markup in double curly braces. When your app sends an email, the `data` it sends is available as `value`. ## Open the editor Open a profile and click a template card. The editor shows the HTML on the left and a preview inside the profile layout on the right. ![The template editor with the HTML on the left and the preview on the right](/files/JapWJq21s60f.webp) Click **SUBMIT** to save, or **Cancel** to close without saving. ## Show values ```html

Hello {{ value.name }},

Your {{ value.plan }} plan is ready.

``` If your app sends `"data": { "name": "Jane Doe", "plan": "Pro" }`, the email says "Hello Jane Doe, Your **Pro** plan is ready." - Values are HTML-encoded: `` in your data shows as text, not as italic. - A value that your app does not send stays empty. ## Sample data for the preview Add a JSON block with sample data. The preview uses it, and [Bulk send](../bulk-send/) fills its **Model** field with it. Emails sent by your apps use only the data the app sends. ```html ``` Your apps can read this sample data with [List profiles](../../reference/list-profiles/), as the `model` of each template. ## Helpers Helpers format a value. Write them in a ` ``` ## The subject The **Subject** of a template can use the same markup and data, for example: ```text Invoice {{ value.number }} ``` Your app can also send its own `subject`; it replaces the subject of the template. See [Send an email](../../reference/send-email/). ## Images To add an image to a template: **1.** In the editor, put the cursor where the address of the image should go and right-click. **2.** Choose **Upload file** and pick the image. OpenMail stores the file and inserts its public address, for example `https://mail.example.com/download/JaqA9b1cW61f.png`. Use it in an `img` tag: ```html Demo project ``` The address uses the host name you opened the admin interface with. Open it at its public address, not `127.0.0.1`, before you upload images, or recipients cannot load them. --- title: Test emails project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/test-emails/ updated: 2026-11-19T07:58:08.081Z --- # Test emails > Check the SMTP connection of a profile and send a test of a template to yourself. OpenMail has two tests: one for the SMTP server of a profile and one for a template. ## Test the SMTP server **1.** Open **Profiles**, click the cog on the profile card and choose **Edit**. **2.** Click **Test** next to **SMTP server configuration**. If the server answers, you see "SMTP server is working correctly": ![The message SMTP server is working correctly over the profile form](/files/JapWK029s60f.webp) If it does not, an error message tells you why, for example `Error: connect ECONNREFUSED 127.0.0.1:1126` when nothing listens on that port. The test uses the values in the form, so you can test before you click **SUBMIT**. ## Send a test of a template **1.** Open the template in the editor. **2.** Click **Send test** at the top right. **3.** The field starts with `@`. Replace it with your email address and press Enter. OpenMail sends the preview, with the sample data, to that address with the subject `OpenMail: Test`. The message "Test email has been sent successfully." confirms it. The test email uses the **From** and **Reply to** addresses and the SMTP server of the profile, so it also checks that the server accepts your sender address. --- title: Bulk send project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/bulk-send/ updated: 2026-11-19T07:58:00.462Z --- # Bulk send > Send one template to a list of email addresses from the admin interface. **Bulk send** sends a template to many addresses at once, with the same data for everyone. Every address gets its own email. ## Send a template to a list **1.** Open a profile, click the cog on the template card and choose **Bulk send**. **2.** In **E-mail addresses**, enter the addresses, separated by a comma or a new line. **3.** In **Model**, check the data. It starts with the sample data of the template; change it as you need. It must be valid JSON. **4.** Click **SEND**. ![The Bulk send email form with two addresses and the model](/files/JapW0Y3EY61f.webp) The message "The email has been queued for sending." appears. The emails go out one after the other; follow them in [Logs](../logs/). ## Good to know - Every recipient gets the same data, so write a text that fits everyone, for example "Hello friend". - The emails use the subject of the template, filled with the model. - For emails with personal data, send one request per recipient from your app. See [Send an email](../../reference/send-email/). --- title: Logs project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/logs/ updated: 2026-11-19T07:58:05.739Z --- # Logs > See every email that OpenMail has sent. **Logs** lists the emails that OpenMail has sent, newest first. ## Open the logs Open **Profiles** and click **Logs** at the top right. ![The Logs window with the profile, template, recipient, subject and time of every email](/files/JapWJd1rs60f.webp) | Column | Meaning | |---|---| | **Profile**, **Template** | What was used. | | **Email** | The recipient. | | **Subject** | The subject as it was sent. | | **Error** | The SMTP error, if the server refused the email. The row is red. | | **Duration** | How long sending took. | | **Created** | When the email was sent. | ## Find an email - Type in a **Filter** field under a column heading to filter, for example a recipient address. - Click a column heading to sort. - Use the arrows at the bottom to move between pages. Click **Close** to go back. ## Good to know - Logs are kept in the file `databases/logs.nosql`. OpenMail does not delete them. See [Back up your data](../backups/). - An email shows in the logs once the SMTP server has accepted or refused it. OpenMail does not know whether it reached the inbox. --- title: API tokens project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/api-tokens/ updated: 2026-11-19T07:58:00.462Z --- # API tokens > Create a token for every app that sends email through OpenMail. Your apps send email with an **API token**. Give every app its own token, so you can change one without touching the others. ![The Tokens screen with the tokens Demo app and Website](/files/JapW0R38Y61f.webp) ## Create a token **1.** Click the key icon on the left to open **Tokens**, then click **Create**. **2.** Enter a **Name**, for example `Demo app`. **3.** **Access token** is already filled with a random value. Keep it, or enter your own (5 to 50 characters). **4.** Leave **Allow read list of profiles** checked if the app needs the list of templates. See [List profiles](../../reference/list-profiles/). **5.** Click **SUBMIT**. ![The token form with the name, access token and Allow read list of profiles](/files/JapW0T39Y60f.webp) The value is shown as dots. To copy it for your app, click the token card to open it, click into **Access token**, select the value and copy it. ## What a token can do Every token can send email with any template of any profile. With **Allow read list of profiles** it can also read the list of profiles and templates. A token gives no access to the admin interface. ## Change or revoke a token Click a token card to open it, change the **Access token** and click **SUBMIT**. The old value stops working at once, and the app gets `401 Unauthorized` until you give it the new value. Use this to revoke a token: give it a new random value that you do not hand out. ## Good to know - Keep tokens out of public code, such as JavaScript that runs in the browser. Send email from your server. - After six requests with a wrong token, OpenMail blocks the address that sent them for up to 15 minutes, even with a valid token. See [Errors](../../reference/errors/). --- title: Configuration project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/configuration/ updated: 2026-11-19T07:58:04.051Z --- # Configuration > Change the name of the app and the primary access token. **Configuration** holds the settings of the app itself. Open it with the cog icon on the left. ![The Configuration screen with Name and Primary access token](/files/JapWJM1cs61f.webp) ## Name **Name** is the name of the app. It is shown as the title of the browser tab, on the home page `/`, and in the subject `OpenMail: Test` of [test emails](../test-emails/). Click **SUBMIT** to save it. ## Primary access token The **Primary access token** protects the admin interface. Without it, anyone who can reach the server can use the admin interface. To set or change it: **1.** Click **Generate**, or type your own token. **2.** Copy the token and keep it in a safe place. **3.** Click **SUBMIT**, then **OK**. The app reloads at `/setup/?token=` with the new token. The old token stops working. The primary access token is only for the admin interface. Your apps send email with [API tokens](../api-tokens/). --- title: Import and export project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/import-export/ updated: 2026-11-19T07:58:04.366Z --- # Import and export > Copy profiles and templates to another installation with JSON files. **Export** saves a profile or a template as a JSON file. **Import** loads such a file. Use them to copy your setup to another OpenMail installation or to keep a copy of a template. ## Export - A profile: on **Profiles**, click the cog on the profile card and choose **Export**. The file contains the profile, its layout, its SMTP settings and all its templates. - A template: open the profile, click the cog on the template card and choose **Export**. The browser downloads a file named after the profile or template, for example `Demo project.json`. The export of a profile contains the **SMTP configuration**, including the SMTP password if you entered one. Keep the file as safe as the password. ## Import - A profile: on **Profiles**, click **Import** and choose the JSON file. - A template: open the profile that should get it, click **Import** and choose the JSON file. The message "The profile **Demo project** has been imported successfully." confirms it. ## Good to know - The file keeps the internal ID of the profile or template. If that ID already exists, the import replaces it. Importing into the same installation therefore overwrites the original instead of adding a copy. To get a copy, use **Clone**. - Check the **Identifier** after an import into another installation: two profiles with the same identifier make the template identifiers ambiguous. --- title: Back up your data project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/backups/ updated: 2026-11-19T07:58:00.462Z --- # Back up your data > Which files hold your data and how to copy them safely. OpenMail keeps all its data in the `databases` folder inside the app folder. ## The files | File or folder | What it holds | |---|---| | `databases/memorize_data.json` | Profiles, layouts, templates, API tokens and the configuration, including the primary access token. | | `databases/logs.nosql` | The [logs](../logs/) of sent emails. | | `databases/fs-files/` | Images uploaded in the template editor. | ## Make a backup **1.** Stop OpenMail. **2.** Copy the `databases` folder: ```bash cp -a databases databases-backup-$(date +%Y%m%d) ``` **3.** Start OpenMail again. `memorize_data.json` contains your SMTP passwords and all tokens in plain text. Store backups where only you can read them. ## Restore a backup Stop OpenMail, replace the `databases` folder with the backup, and start OpenMail again. ## Keep the logs small `logs.nosql` grows with every email. To start over, stop OpenMail, move the file away and start OpenMail again. The next email creates a new file. --- title: Run in production project: OpenMail version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/guides/production/ updated: 2026-11-19T07:58:05.739Z --- # Run in production > Start OpenMail in release mode and protect it on a public server. `npm start` runs OpenMail in debug mode, which is meant for development. On a server, start it in release mode. ## Start in release mode ```bash node index.js 8000 --release ``` To keep it running after you log out and after a restart of the server, start it with a process manager or a system service, for example systemd. ## Protect the server - Set a [primary access token](../first-start/) before the server is reachable from the internet. - OpenMail listens on all network interfaces. Put it behind a reverse proxy such as Nginx with HTTPS, and let only the proxy reach the port of OpenMail. Tokens travel in every request, so never use plain HTTP over the internet. - If only your own servers send email, allow only their addresses at the firewall or in the proxy. - Give every app its own [API token](../api-tokens/). - Back up the `databases` folder. See [Back up your data](../backups/). ## Image links Open the admin interface at its public HTTPS address when you upload images, so the image links in your emails use that address. See [Template markup](../template-markup/). --- title: REST API overview project: OpenMail version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/reference/rest-api/ updated: 2026-11-19T07:58:08.081Z --- # REST API overview > The endpoints your apps call, how to send the token and what comes back. Your apps talk to OpenMail over HTTP. Every address starts with your OpenMail address, for example `https://mail.example.com`. ## Endpoints | Method and path | What it does | |---|---| | `POST /` | [Send an email](../send-email/) with a template. | | `GET /profiles/` | [List the profiles and templates](../list-profiles/). | ## Send the token Every request needs an [API token](../../guides/api-tokens/). Send it in one of two ways: - in the `x-token` header: ```bash curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \ -d '{"id":"demo/welcome","to":"jane@example.com","data":{"name":"Jane Doe","plan":"Pro"}}' \ https://mail.example.com/ ``` - or as the `token` query argument: ```bash curl -H "content-type: application/json" \ -d '{"id":"demo/welcome","to":"jane@example.com","data":{"name":"Jane Doe","plan":"Pro"}}' \ "https://mail.example.com/?token=YOUR_TOKEN" ``` The header keeps the token out of server logs, so prefer it when your app can set headers. ## Request formats `POST /` accepts JSON (`application/json`) and `multipart/form-data`. Use multipart when you want to upload files as attachments. See [Attachments](../attachments/). ## What comes back A successful request answers `200`: ```json {"success":true} ``` Errors come back as a JSON array, for example: ```json [{"error":"Template not found"}] ``` See [Errors](../errors/). --- title: Send an email project: OpenMail version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/reference/send-email/ updated: 2026-11-19T07:58:08.081Z --- # Send an email > POST / sends one email with a template: the fields, the defaults and examples. `POST /` renders a template with your data and sends it. ## Request ```bash curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \ -d '{"id":"demo/welcome","to":"jane@example.com","data":{"name":"Jane Doe","plan":"Pro"}}' \ https://mail.example.com/ ``` ```json {"success":true} ``` ## Fields | Field | Required | Meaning | |---|---|---| | `id` | yes | The template identifier: `profile/template`, for example `demo/welcome`. | | `to` | yes | The recipient. Several addresses separated by commas get one email each. | | `data` | no | An object with the values for the template and the subject, available as `value`. | | `subject` | no | Replaces the subject of the template. | | `reply` | no | A reply address. Replaces **Reply to** of the profile. | | `cc` | no | One address that gets a visible copy. | | `bcc` | no | One address that gets a hidden copy. Replaces **BCC** of the profile. | | `attachments` | no | Files to download and attach. See [Attachments](../attachments/). | The sender is always the **From** address of the profile. ## A full example ```bash curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" -d '{ "id": "demo/welcome", "to": "jane@example.com", "cc": "office@example.com", "bcc": "archive@example.com", "reply": "sales@example.com", "subject": "Your account is ready", "data": { "name": "Jane Doe", "plan": "Pro" } }' https://mail.example.com/ ``` ```json {"success":true} ``` Jane gets the email with the subject "Your account is ready", a copy goes to `office@example.com` and a hidden copy to `archive@example.com`, and replies go to `sales@example.com`. ## Several recipients ```bash curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" \ -d '{"id":"demo/welcome","to":"jane@example.com, john@example.com","data":{"name":"team","plan":"Pro"}}' \ https://mail.example.com/ ``` ```json {"success":true} ``` Each address gets its own email; no recipient sees the others. With several recipients, OpenMail answers before the emails are sent, so `success` does not mean that every email went out. Check [Logs](../../guides/logs/), or send one request per recipient when you need the result. ## When the answer comes With one recipient, OpenMail answers after the SMTP server has accepted the email. Give your HTTP client a timeout, for example 30 seconds, so your app does not wait forever if the SMTP server does not respond. --- title: Attachments project: OpenMail version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/reference/attachments/ updated: 2026-11-19T07:58:08.081Z --- # Attachments > Attach files to an email by URL or by uploading them with multipart/form-data. You can attach files in two ways: give OpenMail their URLs, or upload them with the request. ## Attach files by URL Add `attachments`, a list of objects with `name` (the file name in the email) and `url`: ```bash curl -H "x-token: YOUR_TOKEN" -H "content-type: application/json" -d '{ "id": "demo/invoice", "to": "jane@example.com", "data": { "number": "2026-002", "total": 80 }, "attachments": [ { "name": "invoice-2026-002.pdf", "url": "https://files.example.com/invoices/2026-002.pdf" } ] }' https://mail.example.com/ ``` ```json {"success":true} ``` OpenMail downloads every file before it sends the email, so the URL must be reachable from the OpenMail server. Make sure the URL works: if it answers with an error page, that page is attached under the name you gave. ## Upload files with multipart/form-data Send the fields as form fields and the files as file fields. `data` (and `attachments`, if you use it) must be JSON text: ```bash curl -H "x-token: YOUR_TOKEN" \ -F "id=demo/invoice" \ -F "to=jane@example.com" \ -F 'data={"number":"2026-002","total":80}' \ -F "file=@invoice-2026-002.pdf" \ https://mail.example.com/ ``` ```json {"success":true} ``` Every uploaded file becomes an attachment with its own file name. You can upload several files in one request. ## Size limit A multipart request can be at most about 1 MB (1024 kB) in total. A bigger request is refused with status `431`. For bigger files, use attachments by URL. --- title: List profiles project: OpenMail version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openmail/1-0/reference/list-profiles/ updated: 2026-11-19T07:58:08.081Z --- # List profiles > GET /profiles/ returns the profiles and templates with their identifiers and sample data. `GET /profiles/` returns all profiles with their templates. Use it to show a list of templates in your app, or to find out which data a template expects. The token needs **Allow read list of profiles**. See [API tokens](../../guides/api-tokens/). ## Request ```bash curl -H "x-token: YOUR_TOKEN" https://mail.example.com/profiles/ ``` ## Response ```json [{"id":"JapP3p1ci61f","name":"Demo project","icon":"ti ti-envelope","color":"#4285F4","reference":"demo","templates":[{"id":"JapP4K1di60f","name":"Welcome","reference":"demo/welcome","model":{"name":"Jane Doe","plan":"Pro"}},{"id":"JapPiU1c861f","name":"Password reset","reference":"demo/password-reset","model":{"name":"Jane Doe","url":"https://app.example.com/reset/"}},{"id":"JapPiU1d860f","name":"Invoice","reference":"demo/invoice","model":{"number":"2026-001","total":120}}]}] ``` | Field | Meaning | |---|---| | `id` | The internal ID of the profile. | | `name`, `icon`, `color` | As shown in the admin interface. | | `reference` | The profile identifier. | | `templates[].id` | The internal ID of the template. | | `templates[].name` | The template name. | | `templates[].reference` | The full template identifier. Send it as `id` to [Send an email](../send-email/). | | `templates[].model` | The sample data of the template, from its `