- Docs
- Self-host and operate
- Outgoing email
Outgoing email
Some account features send a message to a person. NuraMesh sends it through an SMTP server you
choose. Mail is off until you set NURAMESH_SMTP_HOST. In the examples every address is written as person@example.com; none is a real one.
Prerequisites
Section titled “Prerequisites”- Shell access to the server’s environment.
- An SMTP server you may send through, its security mode (
starttls,tlsornone) and a sender address. - If the SMTP server needs a login: the password in a file owned by the server’s user, mode
0400or0600, outside any Git repository. - The base URL people open the app at.
- Set
NURAMESH_SMTP_HOST,NURAMESH_SMTP_FROMandNURAMESH_PUBLIC_URLin the server’s environment: The settings. - If the SMTP server needs a login, set
NURAMESH_SMTP_USERandNURAMESH_SMTP_PASSWORD_FILE. - Restart the server. A bad value stops it at start and names the variable.
- Check the setup and send one test message: Check the setup.
What needs mail
Section titled “What needs mail”- Invitations (create and resend):
nuramesh auth invites createand the invitation routes. - Password reset: a person asking for a reset of their own password, an owner’s reset of a
person, and
nuramesh auth password-reset. - Changing your own email address: a link mail to the new address, and a notice to the old one.
- Notices that two-step sign-in was turned on, turned off or reset for a person, and a notice “Your password was changed.” after a password reset is completed.
- A warning to an approver that a decision they are asked to make is about to expire.
Each message is plain text and carries the organization name. The SMTP server you choose is a subprocessor: it sees every recipient and every link, so choose one you trust.
What you see when mail is off
Section titled “What you see when mail is off”With NURAMESH_SMTP_HOST unset the server still starts. The features a person asks for (an invitation, a
password reset, an address change) answer 503 with the code email_not_configured (see the
error reference), and nothing is written. Mail that is only a side effect is
skipped silently: two-step sign-in notices, the approver’s expiry warning and the notices the
command line sends after an operator action. In the app, Settings > People shows a banner when an invitation fails
this way. An operator on the server can still create an invitation without mail:
nuramesh auth invites create takes --print-link.
The settings
Section titled “The settings”Set these in the server’s environment. A bad value stops the server at start; the message names the variable and never its value.
| Variable | What it does |
|---|---|
NURAMESH_SMTP_HOST |
The SMTP server. Unset means mail is off. |
NURAMESH_SMTP_FROM |
The sender address. Required when the host is set. |
NURAMESH_PUBLIC_URL |
The base URL people open, used in links. Required when the host is set. https://, or http:// for localhost only. |
NURAMESH_SMTP_SECURITY |
starttls (default), tls or none. |
NURAMESH_SMTP_PORT |
1 to 65535. Default by security: 587 for starttls, 465 for tls, 25 for none. |
NURAMESH_SMTP_USER |
The login name. Needs the password file. |
NURAMESH_SMTP_PASSWORD_FILE |
A file that holds the password. Needs the login name. |
NURAMESH_SMTP_ALLOW_INSECURE |
Allows none to a host that is not on this machine, for a relay without login. |
NURAMESH_SMTP_TIMEOUT_SECONDS |
Connect and read timeout, 1 to 60. Default 10. |
NURAMESH_MAIL_QUEUE_MAX |
Mails waiting in the background queue, 2 to 1000. Default 100. |
NURAMESH_VERIFY_MAIL_QUEUE_MAX |
The separate queue for address-change links, 8 to 1000. Default 100. |
NURAMESH_ORG_NAME |
The organization name in a message, 1 to 80 characters. Default your organization. |
Rules the code enforces:
- The password is a file, never a value. The file must be a regular file (not a symlink)
owned by the server’s user, with mode
0400or0600, at most 1 KiB, outside any Git repository, one ASCII line. It is read at every send. - No silent downgrade.
starttlsfails if the server does not offer it, and certificates are checked. noneis for this machine. It is accepted forlocalhost,127.0.0.1or::1. For any other host it needsNURAMESH_SMTP_ALLOW_INSECUREand no login: a password is never sent in clear.
The full list of settings is in the configuration reference.
Check the setup
Section titled “Check the setup”nuramesh email statusWith no settings it prints which ones are missing and exits 1:
email: offmissing: NURAMESH_SMTP_HOSTmissing: NURAMESH_SMTP_FROMmissing: NURAMESH_PUBLIC_URLWith mail set up it prints email: on and exits 0. If a setting is invalid it prints an error:
line naming the variable and exits 2. It prints names only, never a value.
nuramesh email check --to person@example.comThis sends one fixed test message and records the result. Exit codes:
| Exit | Output | Meaning |
|---|---|---|
| 0 | sent |
The SMTP server accepted the message. |
| 1 | failed: <code> |
The send failed. The code is one of not_configured, connect, tls, auth, rejected, timeout, invalid_message. |
| 2 | email is off: run nuramesh email status, or an error: line |
Email is off (the first form), or a setting is invalid, --to is not a plain ASCII address, or the result could not be recorded (an error: line). |
The server’s own reply is never printed. A signed-in owner can also read
GET /v1/auth/email/status, which returns whether mail is on, what is missing and the queue
counts, never a setting value.
What is recorded
Section titled “What is recorded”A mail that an owner or an operator starts writes an email.sent or email.failed entry in the
ledger: an invitation or resend, an owner’s password reset (and
nuramesh auth password-reset), the “password was changed” notice, the approver’s expiry
warning, a two-step sign-in notice and nuramesh email check. The entry
holds the kind of message, the failure code if any and the recipient as a keyed hash. It never
holds the address, the subject, the text or a link; the address goes to the organization’s
security log instead.
Two kinds are not written as email.sent or email.failed: the mail sent when a person asks
for a reset of their own password, and the two mails of an address change (the link and the
notice).
Troubleshooting
Section titled “Troubleshooting”| You see | Do this |
|---|---|
503 email_not_configured |
Mail is off. nuramesh email status lists the missing settings |
failed: connect or failed: timeout |
The host or port is wrong, or a firewall is in the way. nuramesh doctor --network-checks tests the connection |
failed: tls |
The server does not offer the security mode you set, or its certificate does not check out. There is no silent downgrade |
failed: auth |
The login name or the password file is wrong. The file must be one ASCII line |
failed: rejected |
The SMTP server refused the sender or the recipient |
| The server stops at start | A setting is invalid. The message names the variable, never its value |
| You need an invitation while mail is off | An operator runs nuramesh auth invites create with --print-link |
Next steps
Section titled “Next steps”- Accounts and roles: invitations are what most mail is for.
- Environment variables: every setting.
- Diagnose with
nuramesh doctor.
Was this page helpful?