Skip to content

Email notifications

Applies to: Owner, Administrator and any role with Email.View / Email.Manage; SuperAdmin for platform configuration. Last reviewed: 2026-11-18.

Email is the main channel in DriveFlow. It is included in every plan (feature "Email Notifications") and is switched on by default for a new school.

1. How email is sent

  • The only email service registered in the API is TenantSmtpEmailService (DriveFlow.Infrastructure/Email). It sends by plain SMTP using .NET's SmtpClient, with a 30 second timeout.
  • The repository also contains SmtpEmailService, SendGridEmailService and MailKitEmailService. They are not registered and are not used.
  • Each email has one recipient. There is no CC, BCC or reply-to setting.
  • Attachments (invoice, receipt, quote PDFs) are generated at send time and attached in memory.

Which mail server is used

For every email the service decides in this order:

  1. If the request belongs to a school and that school has Use my own SMTP server saved and enabled, the school's server, username, password, sender name and sender email are used.
  2. Otherwise the platform's global settings (the EmailSettings section of the API configuration) are used.
  3. If the school's saved SMTP password cannot be decrypted, the error is logged ("Failed to decrypt SMTP password for company ...; using global settings.") and the global settings are used.

Emails that are sent from DriveFlow rather than from the school deliberately use the global settings: the school welcome email, the new-registration alert, and subscription invoices. The password reset link email is requested without a signed-in user, so it also goes through the global server.

Note for developers: subscription invoices re-sent from Settings > Billing

SubscriptionInvoiceEmailService switches to "no company" with BeginTenantScope(Guid.Empty), but TenantContext.CompanyId reads the signed-in user's companyId claim before it looks at that override. When a signed-in school user re-sends a subscription invoice from Settings > Billing, the school's own SMTP server would therefore be used if one is enabled. This has not been confirmed by a test.

2. Platform configuration (SuperAdmin / server administrator)

Set in the API's configuration, section EmailSettings. Values are never shown in the application.

Setting Purpose
Host SMTP server name
Port SMTP port. 465 is rejected; use 587
UseSsl Use STARTTLS
Username, Password SMTP sign-in
FromAddress, FromName Sender shown on emails sent through the platform server

Two more settings affect email content:

Setting Purpose
Platform:AppUrl Address of the web app. Used for the logo in the email footer, the student portal link, the "pay online" link and the password reset link. Without it, no password reset email is sent.
Platform:AdminEmail Receives the "New DriveFlow registration" alert. If empty, no alert is sent.

There is no page in the application for these. A SuperAdmin cannot change them from the web interface.

3. Using your own SMTP server (school)

Who: view with Email.View; change and test with Email.Manage. In the default role set these belong to the school's administrative roles. Without Email.Manage the page shows "You can view these settings but not change them."

Where: side menu Settings > Email tile ("Email configuration"). Page title: Email Settings.

Screenshot to be added

Screen: Email Settings. Should show: the Email Provider card with "Use my own SMTP server" selected and the SMTP form visible.

Steps

  1. Open Settings, then click Email.
  2. Under Email Provider choose one of:
    • Use DriveFlow default email - "DriveFlow will send emails using the platform's email server."
    • Use my own SMTP server - "Send emails through your organisation's own SMTP server."
  3. If you chose your own server, fill in the form:

    Field Required Meaning
    SMTP Host Yes Your mail server, for example smtp.example.com
    Port Yes Normally 587. New settings start at 587.
    SMTP Username Yes The mailbox sign-in name
    SMTP Password Yes the first time Leave blank later to keep the saved password
    Use SSL / TLS - On by default
    Sender Name Yes The name students see, for example "Bright Road Driving School"
    Sender Email Yes The address the email comes from
  4. Click Save Changes in the bar at the bottom ("Changes will apply to future emails.").

  5. In the Test Email card type an address in Test email address and click Send Test Email.

Port 465 is not supported

Use port 587 with Use SSL / TLS switched on. Port 465 (implicit SSL) is rejected.

After saving

  • Success message: "Email settings saved successfully."
  • The Email Status card shows Custom SMTP or DriveFlow Default.
  • The password is stored encrypted and is never shown again.
  • Choosing Use DriveFlow default email and saving does not delete your SMTP details; it only switches them off.

Messages you may see

Message Cause
"SMTP host is required when using custom SMTP." Host empty
"SMTP username is required when using custom SMTP." Username empty
"Sender email address is required." Sender Email empty
"Sender email address is not a valid email address." Sender Email badly formed
"Sender name is required." Sender Name empty
"SMTP password is required." First save without a password
"Enter an email address first." Test button pressed with no address
"Test email sent successfully." The mail server accepted the test
"The test email could not be sent: ..." followed by the mail server's reason Wrong host, port, username, password, or the server refused the sender
"... SMTP port 465 (implicit SSL) is not supported. Use port 587 with SSL/TLS enabled instead." Port 465 was entered

Example

Bright Road Driving School uses Microsoft 365. The owner:

  1. Enters Host smtp.office365.com, Port 587, the mailbox address as username and the mailbox password.
  2. Leaves Use SSL / TLS on.
  3. Sets Sender Name to "Bright Road Driving School" and Sender Email to the same mailbox.
  4. Saves, then sends a test to her own address.

From then on booking confirmations, invoices and reminders come from the school's mailbox.

Notes

  • The test email is not written to the Notification Log.
  • The test uses the saved settings. Save first, then test.
  • The API also has a second set of endpoints, api/company/email-settings (GET, PUT, DELETE). The web page does not use them; it uses api/email-settings.

4. Switching email on and off

Switch Where Effect
Email under Notification Channels Settings > Notifications Off stops every engine email, the automatic invoice email and all automatic payment reminders. It does not stop manual sends or account emails.
Enabled on a message row Settings > Notifications Off stops that message on every channel
Email tick on a message row Settings > Notifications Off stops only the email for that message

Emails that ignore these switches

These go because a person asked for them: Send Email on an invoice, Send Reminder on an invoice, Email Receipt, sending a quote, Invite to portal / Resend invite, new user password, password reset, test email, and all emails from DriveFlow to the school.

5. What emails look like

All emails use one branded layout (NotificationEmailTemplate): a blue header with the title and school name, a greeting, text, a grey panel of details, "Regards, <school name>", and a footer saying "This is an automated message. Please do not reply directly to this email." with the DriveFlow logo and website.

The layout supports dark mode in mail apps that honour it. Wording per message is in Notification templates.

6. Delivery status, failures and retries

  • "Sent" means the SMTP server accepted the message. DriveFlow does not track bounces, opens or spam filtering.
  • A failure is stored with the mail server's error text.
  • Nothing is retried automatically.
  • For manual actions the user sees the error straight away, for example "The invoice email could not be sent: ...".
  • For automatic emails the failure is only visible in the Notification Log and the server log.

7. Cost

Email costs nothing in DriveFlow. No credits are used.

8. Limitations and notes

  • Port 465 is not supported.
  • No reply-to address. Students who reply will reach the sender mailbox, despite the footer text.
  • No bounce handling.
  • New user password emails, portal invites, password reset emails and the test email are not in the Notification Log.
  • The school welcome email, registration alert and subscription invoice emails are recorded in the school's Notification Log even though DriveFlow sent them.