Skip to content

📧 Email

LibreFolio sends email through an SMTP server that you name in a few environment variables. Email is optional: without it nothing changes, nothing is sent, and the invitation and password-reset links are copied by hand.

What LibreFolio sends:

  • A test email, which an administrator sends to their own address from Settings › Administration › Email.
  • The invitation and password-reset links created by an administrator, with Send by email in their dialogs: Links Sent by an Administrator.
  • A reset link for a forgotten password, to whoever asks for one from the login page: Forgotten Passwords.
  • The setup link of the initial administrator, once, when LibreFolio creates that administrator from LIBREFOLIO_ADMIN_EMAIL and generates the link itself: The Initial Administrator.
  • A link to confirm the email address of a new account, when Require Email Verification is on: Email Verification.
  • A notice to the old address and a confirmation to the new one when someone changes the email address of their account: Email Address Changes.

The emails with a link also need LIBREFOLIO_PUBLIC_URL: Emails with a Link.

To set email up:

  1. In LibreFolio's .env, section # Email: write the LIBREFOLIO_SMTP_* variables, at least the server and the sender, plus the login when the server asks for one. Copy the example of your case.
  2. In the same .env, for the emails with a link: LIBREFOLIO_PUBLIC_URL (Emails with a Link).
  3. From a terminal: restart LibreFolio. With Docker Compose, run docker compose up -d.
  4. In LibreFolio, Settings › Administration › Email: the state reads Ready. Send yourself a test email.

📚 This guide is split into several pages

This page sets email up: the variables, examples for the usual servers, the Email tab of Settings and its test email. The rest of the guide:


🔐 Where the Configuration Lives

From environment variables only, written in .env like the other options: ./dev.py and Docker Compose (env_file: .env) pass them to the server. The password also in a secret file.

  • Never stored. It is not in the database, and a backup of LibreFolio does not contain it: keep your own copy of .env and of the password file.
  • Never shown. No page of the interface shows the server, the port, the user, the sender or the password. Settings › Administration › Email says whether email works and, if not, which variable to fix; of the LIBREFOLIO_SMTP_* values, it shows only the hourly limit.
  • Public: only whether email is ready. /api/v1/system/instance, readable by anyone who reaches the server, says "available": true when the state is Ready and "links": true when, on top of that, the emails can carry a link (Emails with a Link). Nothing else.
  • Restart after a change. With Docker Compose, run docker compose up -d.

To turn email off: in .env remove LIBREFOLIO_SMTP_HOST or leave it empty, then restart. The other variables can stay: without a server, LibreFolio ignores them.


📋 The Variables

In .env, section # Email. .env.example lists them, commented: copy the lines you need.

Variable Default Accepted values
LIBREFOLIO_SMTP_HOST not set: email off The SMTP server: a host name, such as smtp.example.com, or an IP address, and nothing else: no smtp://, no user@, no :587, no path. An IPv6 address without square brackets, such as fd00::25.
LIBREFOLIO_SMTP_TLS starttls starttls, tls or none, in capitals or not: Encryption Modes.
LIBREFOLIO_SMTP_PORT 587 with starttls, 465 with tls, 25 with none A whole number from 1 to 65535. Set it only if the server uses a port other than the one of its mode.
LIBREFOLIO_SMTP_USER not set: no login The login of your account on the SMTP server.
LIBREFOLIO_SMTP_PASSWORD not set The password of that login, used exactly as written, spaces included. Or LIBREFOLIO_SMTP_PASSWORD_FILE: the path of a file that holds it.
LIBREFOLIO_SMTP_FROM required with a server The sender: an address, with or without a name, such as LibreFolio <noreply@example.com> or noreply@example.com.
LIBREFOLIO_SMTP_REPLY_TO not set: replies go to the sender The address replies go to.
LIBREFOLIO_SMTP_MAX_PER_HOUR 50 How many emails LibreFolio may send in an hour, per server process: a whole number, at least 1.
LIBREFOLIO_SIGNUP_EMAILS_PER_ADDRESS 20 How many registration emails one client address may trigger in an hour, per server process: a whole number, at least 1. Past the limit, new accounts are created and wait, but their emails are held: Limits of the Verification Emails. Not an SMTP variable (its name does not start with LIBREFOLIO_SMTP_), but it is checked with them and read only when a server is set.
  • Empty is the same as not set: an empty value, or one of spaces only, counts as not set.
  • The login comes in pairs: LIBREFOLIO_SMTP_USER together with a password, or neither of them for a server that takes mail without a login.
  • The password in a file: LIBREFOLIO_SMTP_PASSWORD_FILE follows Secrets in Files. The password is the text of the file as it is, whatever characters it holds, without the line breaks at its end. Set only one of the two: if both are set, LIBREFOLIO_SMTP_PASSWORD wins, the file is ignored and the startup log has a warning. Unlike JWT_SECRET_FILE, a password file that cannot be read does not stop the server: email stays off until it is fixed.
  • The hourly limits count per server process, over the last 60 minutes, in memory: LIBREFOLIO_SMTP_MAX_PER_HOUR and LIBREFOLIO_SIGNUP_EMAILS_PER_ADDRESS alike. A restart starts again from zero. ./dev.py server --workers 4 runs four processes, each with its own count: the instance can send up to four times the limit (Start the Server). The Docker image runs a single process.

🔑 Encryption Modes

LIBREFOLIO_SMTP_TLS What it does Usual port
starttls (default) Connects, then switches to encryption before sending anything. A server that does not offer it is refused: nothing goes out in clear. 587
tls Encrypted from the first byte, also called SSL/TLS or SMTPS. 465
none No encryption: messages, links and password travel in clear. Only for a relay on the same machine or on your local network. 25
  • With starttls and tls, LibreFolio checks the server's certificate: it must be valid and issued for the name in LIBREFOLIO_SMTP_HOST. Write the name the certificate is issued for, usually not the IP address.
  • The port follows the mode, not the other way around: LIBREFOLIO_SMTP_PORT=465 alone keeps starttls, which a server on port 465 does not expect. For port 465, set LIBREFOLIO_SMTP_TLS=tls.

💡 Examples

In LibreFolio's .env, in the section that starts with # Email: this version's .env.example has it. If your .env is old and has no such section, add the block of the example at its end. Replace smtp.example.com, the addresses and the password with your own, then restart LibreFolio.

The password stays out of .env and out of the container's environment, in a Docker secret.

  1. In a file next to docker-compose.yml, such as smtp_password.txt: save the password. A line break at its end does not count; spaces do.
  2. From a terminal, in the same folder: the container sees the file with the owner and permissions it has on the host, so make it readable by the user that runs LibreFolio. With the official image it is 1000:1000:

    sudo chown 1000:1000 smtp_password.txt
    sudo chmod 600 smtp_password.txt
    

    An image you built yourself may use other ids: put them in the chown command (Advanced Docker).

  3. In docker-compose.yml: add the marked lines and leave the rest of the service as it is. If the file already has secrets: lists, such as the JWT_SECRET_FILE example of Secrets, add the new lines to those lists:

    services:
      librefolio:
        secrets:                         # added
          - smtp_password                # added
    secrets:                             # added
      smtp_password:                     # added
        file: ./smtp_password.txt        # added
    
  4. In .env: add the variables. If there is a LIBREFOLIO_SMTP_PASSWORD line with a value, remove it: it would win over the file.

    LIBREFOLIO_SMTP_HOST=smtp.example.com
    LIBREFOLIO_SMTP_USER=noreply@example.com
    LIBREFOLIO_SMTP_PASSWORD_FILE=/run/secrets/smtp_password
    LIBREFOLIO_SMTP_FROM=LibreFolio <noreply@example.com>
    

    No LIBREFOLIO_SMTP_TLS and no port: starttls on port 587 is the default.

  5. From a terminal: run docker compose up -d. The state in Settings › Administration › Email reads Ready.

Your account on the SMTP server of a mail provider.

  1. In .env, section # Email:

    LIBREFOLIO_SMTP_HOST=smtp.example.com
    LIBREFOLIO_SMTP_USER=you@example.com
    LIBREFOLIO_SMTP_PASSWORD=your-app-password
    LIBREFOLIO_SMTP_FROM=LibreFolio <you@example.com>
    
    • That is starttls on port 587, the defaults. If the provider gives port 465, add LIBREFOLIO_SMTP_TLS=tls: the port follows.
    • Use an app password, not the password you sign in with: the provider creates it for a single application and you can revoke it without touching your account.
    • The provider's help pages give the server name, the port and the encryption, and which sender addresses your account may use.
    • Better still, keep the password in a file, as in the Docker Compose tab.
  2. Restart LibreFolio. With Docker Compose, run docker compose up -d. The state in Settings › Administration › Email reads Ready.

Your Gmail account, or a Google Workspace one, through Gmail's SMTP server. LibreFolio signs in only with a user and a password, not with «Sign in with Google»: you need an app password, not the password of your Google Account.

  1. In your Google Account: turn on 2-Step Verification, if it is not on yet. App passwords exist only with it.
  2. On myaccount.google.com/apppasswords: create an app password, with a name such as LibreFolio. Google shows it as a code of 16 characters, in four groups of four: copy it. If the page offers no way to create one, Google's help page says why. A work or school account may need its administrator.
  3. In .env, section Email, or at its end if your .env has none:

    # =============================================================================
    # Email config gmail
    # =============================================================================
    LIBREFOLIO_SMTP_HOST=smtp.gmail.com
    LIBREFOLIO_SMTP_USER=you@gmail.com
    LIBREFOLIO_SMTP_PASSWORD=abcdefghijklmnop
    LIBREFOLIO_SMTP_FROM=LibreFolio <you@gmail.com>
    
    • you@gmail.com stands for your full Gmail address, or your work one with Google Workspace.
    • abcdefghijklmnop stands for the app password: its 16 characters without the spaces, because LibreFolio uses the password exactly as written, spaces included. Better still, keep it in a password file as in the Docker Compose tab, without the spaces there too.
    • Spaces are fine in the sender, not in the password.
    • The sender is the same address, with or without a name in front. Gmail sends only from your address, or from one you added and confirmed under Send mail as in Gmail's settings.
    • No LIBREFOLIO_SMTP_TLS and no port: starttls on port 587 is the default and one of Gmail's two modes. For the other, port 465, add LIBREFOLIO_SMTP_TLS=tls: the port follows.
  4. Restart LibreFolio. With Docker Compose, run docker compose up -d.

  5. In LibreFolio, Settings › Administration › Email: the state reads Ready. Click Send a test email: it goes to the address of your account (The Test Email).

To keep it working:

  • A personal Gmail account sends about 500 emails a day: past that, Gmail refuses for a period of 1 to 24 hours. A Google Workspace account has 2,000 a day through smtp.gmail.com. These are Google's limits, and Google can change them. When Gmail refuses, the test email and the log report the refusal (Sending Errors).
  • LibreFolio's limit is 50 emails an hour by default: up to 1,200 in a day. To stay under the personal limit, in .env add LIBREFOLIO_SMTP_MAX_PER_HOUR=20, that is 480 a day, and restart. The count is per server process: The Variables.
  • Google revokes app passwords when you change the password of your Google Account: create a new one, write it in place of the old one in .env and restart. Removing the app password, on the page where you created it, also stops LibreFolio from sending.

A relay such as Postfix, on the same machine or on your network, takes mail without a login and delivers it for LibreFolio. Three cases; in each one the variables go in .env, section # Email, then restart.

LibreFolio on the host, relay on the same machine:

LIBREFOLIO_SMTP_HOST=localhost
LIBREFOLIO_SMTP_TLS=none
LIBREFOLIO_SMTP_FROM=LibreFolio <noreply@example.com>

LibreFolio in Docker, relay in another container on the same Docker network, here a Compose service called smtp-relay:

LIBREFOLIO_SMTP_HOST=smtp-relay
LIBREFOLIO_SMTP_TLS=none
LIBREFOLIO_SMTP_FROM=LibreFolio <noreply@example.com>

LibreFolio in Docker, relay on the host: inside a container, localhost is the container, not the host.

  1. In docker-compose.yml: add the marked lines.

    services:
      librefolio:
        extra_hosts:                                # added
          - "host.docker.internal:host-gateway"     # added
    
  2. In .env: LIBREFOLIO_SMTP_HOST=host.docker.internal, with LIBREFOLIO_SMTP_TLS=none and the sender as above.

  3. In the relay: let it accept mail from the Docker network (in Postfix: inet_interfaces and mynetworks).

In every case:

  • Port 25 is the default with none: set LIBREFOLIO_SMTP_PORT only if the relay listens on another one.
  • No user and no password: a relay without login does not ask for them.
  • The relay delivers the mail: it must be allowed to send for the domain of LIBREFOLIO_SMTP_FROM.
  • none sends in clear: use it only towards your own machine or your own network. Towards any other server, Settings › Administration › Email and the startup log show a warning.

🖥️ Settings › Administration › Email

In LibreFolio: Settings (gear icon in the sidebar) › Administration › the Email tab, after Backup (on a phone: the shield icon, then the envelope icon). Only administrators see it. The book icon at the top opens this page.

🚦 The State

State What it means What the tab shows
Off LIBREFOLIO_SMTP_HOST is not set: nothing is sent. This is the default. A short explanation and a pointer to this guide.
Ready Every variable can be used. The emails left this hour, the notices that apply, the address the emailed links start with and its check, and Send a test email.
Not working A variable cannot be used: email stays off until it is fixed. The problem, with the name of the variable at fault, and a reminder to restart after the fix.

✅ Ready does not mean an email has already been delivered

Ready means that every variable can be used. LibreFolio does not contact the server until it sends an email: only a test email proves that the server takes your mail.

  • Not working names one problem at a time, the first it finds: fix it in .env, restart, then check again. Configuration Problems says what to check for each one.
  • With Ready, the tab counts the emails left, for example 48 of 50 emails left this hour: the last 60 minutes, not the clock hour. When none is left, it says in how many minutes the next one can go. With several server processes, each one counts its own: the tab shows the count of the process that answered.
  • The encryption warning appears when LIBREFOLIO_SMTP_TLS=none points to a server outside your local network: Security Notes.
  • A notice about LIBREFOLIO_PUBLIC_URL appears when it is not set (information: emails work, but no email with a link can go out) or cannot be used as the base of a link (warning): Emails with a Link.

With the state Ready and a usable LIBREFOLIO_PUBLIC_URL, the tab shows Links in emails start with …, followed by that address, and checks from this browser that this instance answers there. It is the same signed check as the invitation and reset dialogs (The Server Address of a Link).

Message What it means
Checking from this device that this instance answers there… The check is running.
This instance answers there, from this device. Fine: the links reach this LibreFolio instance, at least from here.
From this device, another server answers at that address, not this instance. … Something answers there, but not this LibreFolio instance.
This device cannot reach this instance at that address. … No answer that this browser could read: a wrong or closed address, a name this device does not resolve, no answer within 8 seconds, a browser that blocks a public page from reaching a local address or asks your permission first, or an older version of LibreFolio that cannot answer the check.
This page uses https:// while LIBREFOLIO_PUBLIC_URL starts with http:// … This browser cannot check an http:// address from an https:// page, and the links in emails would travel unencrypted: set the variable to the https:// address.
This browser cannot read LIBREFOLIO_PUBLIC_URL as an address … The browser reads addresses a little more strictly than the server: the links may not open. Check the value.

📱 This device only

The check runs from the browser you are using, so it says what this device sees. A VPN, a direct IP address, its DNS or its network can differ from your users': after a warning, check from another device before changing the variable. Check again repeats the check, for example after you changed network.

  • The check runs once when the tab opens, not after each test email. Check again appears with a warning.
  • Nothing is checked with the state Off or Not working, nor when LIBREFOLIO_PUBLIC_URL is not set or cannot be used, which the notice above reports.

✉️ The Test Email

In LibreFolio, Settings › Administration › Email, with the state Ready: Send a test email sends an email to yourself.

  • To your address: the email of your account, as in Profile. There is no field to type another one.
  • In your language: the one in your Preferences, otherwise the instance's Default Language (Global Settings), otherwise English.
  • What it says: the subject is LibreFolio test email in English. The message names your instance by the address the browser reached it at, not by LIBREFOLIO_PUBLIC_URL, and says that, if you can read it, LibreFolio can send emails. It comes as plain text with an HTML version.
  • It counts against the hourly limit, even when the server refuses it.

The result appears below the button. Test email sent to your address: the SMTP server accepted the message; check your inbox and the spam folder. Otherwise the tab says what went wrong: Sending Errors. While LibreFolio talks to the server, the button reads Sending…: LibreFolio waits up to 20 seconds for each step, so a server that does not answer takes a while to fail.