Skip to main content

Email Notifications

Klear sends transactional emails at each key stage of the expense approval lifecycle. All sends are best-effort — a delivery failure never blocks a state transition.

Notification matrix

TriggerRecipientSubject
Expense submittedStep-1 approver[Klear] Expense pending your approval: {Merchant} — SGD {Amount}
Step N approved, step N+1 waitingStep-N+1 approver[Klear] Your approval needed: {Merchant} — SGD {Amount}
All steps approvedSubmitter[Klear] Approved: {Merchant} — SGD {Amount}
Expense rejectedSubmitter[Klear] Rejected: {Merchant} — SGD {Amount}
Info requestedSubmitter[Klear] Info requested: {Merchant}

When approvers are notified

Klear notifies approvers one step at a time, not all at once:

  • On submission, only the step-1 approver receives an email.
  • When step 1 approves, step-2 is activated and receives its own email.
  • This continues until the chain is complete or the expense is rejected.

This means each approver is emailed exactly when it becomes their turn — no premature notifications for later steps.

When submitters are notified

The submitter receives an email only when the expense reaches a terminal or actionable state:

  • Approved — once every step in the chain has been approved (not on each intermediate step)
  • Rejected — includes the reason category and the approver's note
  • Info requested — includes the approver's free-text message so the submitter knows what to provide

Submitters do not receive an email when an intermediate step approves; they are only notified on the final outcome.

Email format

Every notification contains:

  • A branded HTML version with the Klear cyan header and an inline expense summary card
  • A plain-text fallback for clients that do not render HTML

Both versions include a deep-link button/URL to the relevant page in Klear (approvals inbox or expense detail).

Configuring the email provider

Email is configured at the server level via environment variables. Three providers are available:

ProviderKLEAR_EMAIL_PROVIDER valueWhen to use
LoglogDevelopment — prints to stdout, no real sends
MailgunmailgunProduction (Singapore / global)
ResendresendProduction alternative

Mailgun setup

KLEAR_EMAIL_PROVIDER=mailgun
KLEAR_EMAIL_API_KEY=key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
KLEAR_EMAIL_FROM=Klear <[email protected]>
KLEAR_MAILGUN_DOMAIN=mail.yourdomain.sg
KLEAR_MAILGUN_REGION=us # or "eu" for EU-hosted accounts

KLEAR_MAILGUN_DOMAIN is your verified Mailgun sending domain and must match the domain portion of KLEAR_EMAIL_FROM.

Resend setup

KLEAR_EMAIL_PROVIDER=resend
KLEAR_EMAIL_API_KEY=re_xxxxxxxx
KLEAR_EMAIL_FROM=Klear <[email protected]>

Development / testing

With KLEAR_EMAIL_PROVIDER=log (the default), all emails are printed to the API server's stdout. No credentials are required and no real emails are sent. This is the default on make up.

Delivery guarantees

  • Sends are fire-and-forget: a provider error is logged but the approval action still succeeds.
  • There is no retry queue. If a send fails, it is not re-attempted.
  • Custom headers (X-Klear-Expense-ID) are attached to every message for provider-side filtering.