🎉 monetr is now live! Read the announcement here. Or Sign Up!

Email/SMTP Configuration

monetr supports sending email notifications (and email verification) if SMTP is configured. Currently emails can be sent when a user creates a new account, forgets their password, or changes their password.

All email features require that enabled is set to true and a valid smtp config is provided. monetr does not support specific email APIs and has no plans to. Several email providers offer an SMTP relay, this is monetr’s preferred method of sending emails as it is the most flexible.

Below is an example of the email/SMTP configuration block:

config.yaml
email:
  enabled: true
  domain: "example.com"
  verification: { ... }   # Email verification configuration
  forgotPassword: { ... } # Password reset via email link
  smtp: { ... }           # SMTP configuration
NameTypeDefaultDescription
enabledBooleanfalseAre email notifications enabled on this server?
domainStringEmail domain used to send emails, emails will always be sent from no-reply@{DOMAIN}. Do not provide a full URL with a protocol.

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_EMAIL_ENABLEDemail.enabled
MONETR_EMAIL_DOMAINemail.domain

Email Verification Configuration

If you want to require users to verify their email address when they create a new login on monetr, you can enable email verification. This will email users a link that they must click after creating their login, the link’s lifetime can be customized if needed.

An example of the email verification config:

config.yaml
email:
  verification:
    enabled: true      # Can be true or false
    tokenLifetime: 10m # Duration that the verification link should be valid

The token lifetime is parsed using time.ParseDuration(...), any value that can be parsed using that function is a valid configuration value.

NameTypeDefaultDescription
enabledBooleanfalseIs email verification enabled/required on this server?
tokenLifetimeDuration10mHow long should the link in the verification email be valid?

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_EMAIL_VERIFICATION_ENABLEDemail.verification.enabled
MONETR_EMAIL_VERIFICATION_TOKEN_LIFETIMEemail.verification.tokenLifetime

Forgot Password Configuration

If you ever lose your password and need to reset it, the easiest way is by using the forgot password form. This will send an email to the user (if a user with that email exists) that includes a link to reset their password. Similar to the Email Verification Configuration, this also only requires an enabled and tokenLifetime value.

Example of the forgot password configuration:

config.yaml
email:
  forgotPassword:
    enabled: true      # Can be true or false
    tokenLifetime: 10m # Duration that the password reset link should be valid
NameTypeDefaultDescription
enabledBooleanfalseAre users allowed to reset their password via forgot password?
tokenLifetimeDuration10mHow long should the password reset link be valid?

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_EMAIL_FORGOT_PASSWORD_ENABLEDemail.forgotPassword.enabled
MONETR_EMAIL_FORGOT_PASSWORD_TOKEN_LIFETIMEemail.forgotPassword.tokenLifetime

SMTP Configuration

Make sure to read the documentation for your email provider. monetr requires TLS support from the SMTP server that it is connecting to. This can be via STARTTLS or via a dedicated TLS port on the server. Consult your providers documentation for specifics.

monetr’s SMTP implementation requires TLS. Your email provider must support TLS on whatever port specified below.

config.yaml
email:
  smtp:
    username: "..." # SMTP Username
    password: "..." # SMTP Password or app password depending on provider
    host: "..."     # Domain name of the SMTP server, no protocol or port specified
    port: 587       # Use the port specified by your provider, could be 587, 465 or 25
NameTypeDefaultDescription
usernameStringThe username provided by your SMTP provider or relay.
passwordStringThe password provided by your SMTP provider or relay, this may also be an API credential or an “app password” depending on your provider.
hostStringThe hostname or IP address of the SMTP server you are sending email with.
portStringThe port specified by your provider to use, typical ports are 587, 465 or 25.

The following environment variables map to the following configuration file fields. Each field is documented below.

VariableConfig File Field
MONETR_EMAIL_SMTP_USERNAMEemail.smtp.username
MONETR_EMAIL_SMTP_PASSWORDemail.smtp.password
MONETR_EMAIL_SMTP_HOSTemail.smtp.host
MONETR_EMAIL_SMTP_PORTemail.smtp.port