Koha Solutions

Configuration & operations

How to configure SMTP in Koha so notices actually send

Koha queues every notice and a cron job delivers them. Configure the SMTP server, turn email on for the instance, and check the queue — in that order.

Updated 2026-08-09 · Tested against Koha 26.05

Koha does not send email when a notice is generated. It writes the notice to a queue, and a cron job delivers the queue every 15 minutes. So "notices are not sending" is almost always one of three things: no SMTP server configured, email not enabled for the instance, or the queue job not running. Fix them in that order.

This article is for a package install

It assumes Koha installed from the Debian/Ubuntu koha-common package, which is what koha-create gives you. On a git install the same three things are true, but the cron entries are yours to write and koha-email-enable does not exist.

Step 1Add an SMTP server in the staff interface

Since Koha 20.05 the mail server is configured in the database, not in a config file. Every instance starts with one implicit default — localhost on port 25, no encryption — which works only if a mail transfer agent is running on the same box and is allowed to relay. Most servers have neither.

  1. 1Go to Administration → Additional parameters → SMTP servers.
  2. 2Click New SMTP server.
  3. 3Name — anything you will recognise later, e.g. Library mail.
  4. 4Host — your provider's server, e.g. smtp.example.org.
  5. 5Port587 for STARTTLS, 465 for SSL, 25 only for an unauthenticated relay on your own network.
  6. 6SSL modeSTARTTLS with port 587, SSL with port 465, Disabled with port 25.
  7. 7User name and Password — leave both blank for an unauthenticated relay; otherwise the mailbox credentials.
  8. 8Tick Default so every library uses it, then Submit.

Port and SSL mode must agree

Port 587 with SSL mode SSL, or port 465 with STARTTLS, fails at connect time — and Koha records the failure in the queue rather than on screen, so the save looks successful. If nothing sends after this step, that pairing is the first thing to re-check.

Step 2Set the addresses notices come from

A message with no sender is rejected by most receiving servers before it reaches a mailbox. Koha takes the from-address from the branch first and falls back to a system preference.

  1. 1Set Administration → Libraries → your library → Email address. This is what patrons see and reply to.
  2. 2Set Administration → System preferences → KohaAdminEmailAddress as the fallback.
  3. 3If your provider only accepts mail from an address it hosts, both must be an address at that domain — not a personal address forwarded to it.

Step 3Turn email on for the instance

This is the step almost every published guide leaves out, and the reason a correctly configured SMTP server still sends nothing. The package's cron entry runs the queue only for instances that have email enabled, which is a flag file on disk — not a setting in the staff interface.

Terminal
sudo koha-email-enable library

Replace library with your instance name; sudo koha-list prints it. Confirm the flag took:

Terminal
sudo koha-list --email library

If your instance is not in that list, the delivery job is skipping it and nothing else you change will matter.

Step 4Drain the queue and watch it work

Do not wait 15 minutes to find out. Run the delivery job by hand, with verbose output:

Terminal
sudo koha-foreach --chdir --enabled --email \    /usr/share/koha/bin/cronjobs/process_message_queue.pl -v

A working run prints one line per message sent. A run that prints nothing at all means the queue is empty — generate a test notice first, for example by triggering a password reset or checking an item out to a patron with an email address and messaging preferences set.

Read the queue directly when you need the truth

The staff interface shows notices per patron. To see the whole queue and why a message is stuck, query it: sudo koha-mysql library -e "SELECT message_id, status, time_queued, LEFT(to_address,40) FROM message_queue ORDER BY message_id DESC LIMIT 20;". A row sitting at pending was never attempted; failed was attempted and refused.

Why it works this way

Koha queues rather than sends because sending is slow and unreliable and the thing that triggered it is not. A checkout that had to wait for an SMTP handshake would block the circulation desk every time the mail server was busy, and would fail the checkout outright when the mail server was down. Writing a row and moving on means a delivery problem is a delivery problem, never a circulation one.

The cost is that email has three independent failure points instead of one, and none of them reports to the screen where the notice was generated. The queue is the seam: anything before it is a Koha configuration problem, anything after it is a mail problem, and the status column tells you which side you are on.

The per-instance email flag exists because one server runs many instances. A test instance restored from a production backup still holds every real patron address, and an operator who did not want it emailing them would have no way to stop it if delivery were simply always on.

It is still not sending

What you seeWhat it usually is
Queue rows stay at <code>pending</code> foreverThe instance is not in koha-list --email, so the cron job skips it. Run koha-email-enable.
Rows go to <code>failed</code> immediatelyWrong port/SSL-mode pairing, or credentials the provider rejected. Re-check step 1.
Nothing is ever queuedThe patron has no email address, or no messaging preference is ticked for that notice type — EnhancedMessagingPreferences must be on, and the notice must be enabled per patron category.
Sent, but nothing arrivesThe from-address is not one your provider is allowed to send as. Check the provider's own rejection log; Koha only knows the message was accepted.
Works by hand, not on scheduleThe koha-common cron entry was edited or the package cron file is missing. See Koha cron jobs.

If you are using a Gmail or Google Workspace mailbox as the sending account, the credentials work differently — see using a Gmail account as Koha's SMTP server.

Share this article

Would rather not do this yourself? We do it as a service — and if you would rather it were already done, it is on Koha Cloud before you log in.