Skip to main content

Email Settings

These are Endatix API settings (appsettings.json). They pick the mail provider and overlay identity-template senders. Hub’s .env does not hold SMTP keys.

Template HTML, subject, and a default FromAddress live in the seeded database. Until Hub can edit those rows, hosts change the sender in config — no database edit required.

Email providers​

Provider settings bind under Endatix:Integrations:Email:{SettingsClassName}. SMTP is the default provider and does not require explicit activation.

Secrets

Store API keys and SMTP passwords in environment variables or a secrets manager. Do not commit production credentials.

SendGrid​

To use SendGrid as your email provider, you need to configure the SendGridSettings section. The Endatix API uses the official SendGrid APIs to deliver emails reliably.

Configuration Example​

{
"Endatix": {
"Integrations": {
"Email": {
"SendGridSettings": {
"ApiKey": "SG.your_api_key_here"
}
}
}
}
}

Properties​

  • ApiKey (Required): Your SendGrid API key with "Mail Send" permissions.

The sender is not a SendGrid setting: set it once in the deployment sender, with an address verified in your SendGrid account.

For implementation details, refer to SendGridSettings.cs.


Mailgun​

To use Mailgun, configure the MailgunSettings section. This integration uses the Mailgun REST API.

Configuration Example​

{
"Endatix": {
"Integrations": {
"Email": {
"MailgunSettings": {
"ApiKey": "key-your_mailgun_api_key",
"Domain": "mg.yourdomain.com",
"BaseUrl": "https://api.mailgun.net/v3"
}
}
}
}
}

Properties​

  • ApiKey (Required): Your private Mailgun API key.
  • Domain (Required): The sending domain verified in your Mailgun account.
  • BaseUrl: The Mailgun API base URL. Use https://api.eu.mailgun.net/v3 if your domain is hosted in the EU region.

The sender is not a Mailgun setting: set it once in the deployment sender, with an address on your Mailgun domain.

For implementation details, refer to MailgunSettings.cs.


SMTP​

If you prefer to use a standard SMTP server (such as Amazon SES, Postmark, or a custom corporate mail server), Endatix provides an SmtpEmailSender implementation using MailKit, the open-source .NET SMTP/MIME library. This supports both STARTTLS (the traditional port 587 setup) and implicit TLS/SMTPS (typically port 465).

info

Not to be confused with mailkit.com, an unrelated email service provider — this is about the MailKit library, used here purely as the transport for your own SMTP server.

Configuration Example​

{
"Endatix": {
"Integrations": {
"Email": {
"SmtpSettings": {
"Host": "smtp.example.com",
"Port": 587,
"EnableSsl": true,
"Username": "your_smtp_username",
"Password": "your_smtp_password"
}
}
}
}
}

Properties​

  • Host (Required): The SMTP server host name or IP address (e.g., localhost or smtp.mail.company.com).
  • Port: The SMTP server port number. Defaults to 587.
  • EnableSsl: Whether to enable transport security. Combined with Port to pick a SecurityMode automatically when SecurityMode is left at its default — see below. Defaults to true.
  • SecurityMode: Explicitly controls how the connection is secured, overriding the EnableSsl/Port heuristic. One of Auto (default), None, StartTls, StartTlsWhenAvailable, or SslOnConnect. Use SslOnConnect for implicit TLS/SMTPS servers (typically port 465) if auto-detection based on port doesn't fit your setup.
  • CheckCertificateRevocation: Whether to check the server's TLS certificate for revocation (OCSP/CRL) during the handshake. Defaults to false, since some networks block the endpoints this check needs, which would otherwise cause connections to fail. Set to true for stricter certificate validation if your network allows it.
  • Username: The username for SMTP authentication. If left empty, the connection is made without authentication (a warning is logged).
  • Password: The password for SMTP authentication.

The sender is not an SMTP setting: set it once in the deployment sender.

For implementation details, refer to SmtpSettings.cs.

Local development: Mailpit​

To catch every email locally instead of sending it, start Mailpit with docker compose -f docker/docker-compose.mailpit.yml up and point SMTP at it. Read the messages at http://localhost:8025 (UI and REST API).

"SmtpSettings": { "Host": "127.0.0.1", "Port": 1025, "EnableSsl": false }
Upgrading from the .NET SmtpClient-based sender

Earlier Endatix versions sent SMTP mail using .NET's built-in System.Net.Mail.SmtpClient, which Microsoft's own docs no longer recommend for new development. The MailKit-based sender is a drop-in replacement — no configuration changes are required for the common case of a Host/Port combination with username/password authentication over STARTTLS. Two behaviors changed:

  • Blank Username on Windows. Previously, leaving Username empty made SmtpClient authenticate using the Windows process identity (UseDefaultCredentials). MailKit has no equivalent, so a blank Username now always means an unauthenticated connection. This only matters if you relied on integrated Windows authentication with no explicit username — outside of that, an empty Username behaves the same as before.
  • Certificate revocation checking. Not checked previously; still not checked by default now (CheckCertificateRevocation defaults to false), but it's newly available as an opt-in for stricter validation.
info

For an overview of email providers and how to activate them in Endatix API see the Email Providers Guide.

Deployment sender​

One sender, for every provider, binds under Endatix:Integrations:Email:Sender. It applies to emails the API renders from a stored template, and on SMTP to an email sent without a From address. A provider template (a SendGrid or Mailgun template id) sends the From its caller sets, without a display name.

{
"Endatix": {
"Integrations": {
"Email": {
"Sender": {
"Address": "noreply@yourdomain.com",
"Name": "Your Product"
}
}
}
}
}

A bare address, with no display name. When set, every stored-template email sends from it; only a per-template Endatix:EmailTemplates:*:FromAddress wins over it (see sender address resolution). Left empty, each template sends from the address its database row stores. On SMTP, it is also the sender of an email without a From address, and noreply@endatix.com when empty; Mailgun and SendGrid require such an email to set its own From.

The From display name of every stored-template email whose address has no name of its own, and on SMTP of an email without a display name. A per-template FromAddress written as Name <address> keeps its own name. Defaults to the deployment's product name: Endatix, or the brand pack's name when white-labeling is on.

The API does not start when Address holds a display name or Name holds a control character.

Deprecated: SmtpSettings:DefaultFromAddress and DefaultFromName

Move them to Sender:Address and Sender:Name. Until you do, the API still reads them, below Sender:*, and logs one warning at startup that names the new keys. As before, DefaultFromAddress sends only an email with no template and no From address; it never replaces a template row's address.

How to change the sender today​

Set Endatix:EmailTemplates:*:FromAddress and restart the API. That is the supported way to change the sender without a database change. Hub list and send both use the same effective address.

{
"Endatix": {
"Hub": {
"HubBaseUrl": "https://hub.example.com"
},
"EmailTemplates": {
"EmailVerification": {
"TemplateId": "email-verification",
"FromAddress": "noreply@yourdomain.com"
},
"UserInvitation": {
"TemplateId": "user-invitation",
"FromAddress": "noreply@yourdomain.com"
},
"ForgotPasswordEmail": {
"TemplateId": "forgot-password",
"FromAddress": "noreply@yourdomain.com"
},
"PasswordChangedEmail": {
"TemplateId": "password-changed",
"FromAddress": "noreply@yourdomain.com"
}
}
}
}

HubBaseUrl is used to build Hub links inside emails (verify-email, activate-invite, reset-password). That is an API setting — see API Hub URL.

Template map​

Config keyTemplate name in HubUsed for
EmailVerificationemail-verificationConfirm an email address (self-service registration / create-account)
UserInvitationuser-invitationAdmin invite — recipient sets a password on Activate invite
ForgotPasswordEmailforgot-passwordPassword reset
PasswordChangedEmailpassword-changedPassword changed notice

Each entry has:

PropertyDescription
TemplateIdDatabase template name (SMTP/Mailgun) or a provider template id (for example a SendGrid template id)
FromAddressOptional. When set, list and send use this address instead of the database row. It may carry a display name (Ops Team <ops@yourdomain.com>); that name is sent as is, and the deployment sender Name fills only a bare address. Left empty (or omitted), the template sends from the deployment sender Address when that is set, and from the database row only when it is not.

Sender address resolution​

When Endatix sends or lists a template, the from-address is:

  1. FromAddress from Endatix:EmailTemplates for that template, if it is not empty (customer override, no DB edit)
  2. The deployment sender Address, if it is set
  3. The address stored on the database template (seed today; Hub UI later)
  4. The deployment sender's address, noreply@endatix.com by default, only if the row's address is empty

The Hub Email Settings page shows the same resolved value that send uses, including a display name written in FromAddress. A bare address is sent named by the deployment sender Name.

Future Hub UI

A future Hub UI will let admins edit from-address (and HTML) per tenant via the API. When that ships, this config overlay goes away. Until then, keep using Endatix:EmailTemplates:*:FromAddress.

The shipped admin-invite email is UserInvitation. The seeded template name remains user-invitation (that is the name Hub lists). A custom TemplateId (for example a SendGrid id) is left unchanged.

EmailVerification and UserInvitation are independent. Self-service registration and admin invite stay on separate templates so they can diverge later without a breaking rename.