Mail Management

Mail Management

The Mail Management system handles the sending of emails within the platform. It requires an SMTP secret created in Secret Management. It also integrates with Template Management to use customizable email templates for common workflows.

Functional areas

Mail Management offers the following key functions:

Outgoing email handling

  • Test your email configurations
  • Send default test emails
  • Send emails that use a template

Mail logs

  • Keep a record of sent emails
  • View message status, timestamp, and recipient
  • Search and filter logs for troubleshooting

Email templates

  • Uses predefined templates from Template Management for standard messages
  • Templates include registration confirmation, password reset, and various notifications
  • Templates can be edited in Template Management without code changes

Code usage

In addition to the UI workflows, Mail Management can also be used directly in code.
The following example demonstrates how to send a simple text email via the SendMail use case:

⚠️
An SMTP server must be configured, otherwise sending emails will fail.
See Secret Management for configuration details.
import (
    "go.wdy.de/nago/application/mail"
    "go.wdy.de/nago/application/user"
    "go.wdy.de/nago/pkg/std"
    netmail "net/mail"
)

mailManagement := std.Must(cfg.MailManagement())

_, err := mailManagement.UseCases.SendMail(user.SU(), mail.Mail {
	To:       []netmail.Address{{Address: "nago@dev.com"}},
	CC:       nil,
	BCC:      nil,
	From:     netmail.Address{},
	Subject:  "Test Mail",
	Parts:    []mail.Part{mail.NewTextPart("This mail was sent via the SendMail usecase.")},
	SmtpHint: "",
})

Dependencies

Requires:

If these are not already active, they will be enabled automatically when Mail Management is activated.

Is required by:

Activation

This system is activated via:

std.Must(cfg.MailManagement())
mailManagement := std.Must(cfg.MailManagement())