smtp

package
v0.0.0-...-2757dea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package smtp provides implementations of services for sending e-mails using an SMTP server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailHeader

type EmailHeader struct {
	Key   string
	Value string
}

type EmailService

type EmailService struct {
	// contains filtered or unexported fields
}

func NewEmailService

func NewEmailService(cfg config.EmailConfig) (*EmailService, error)

func (*EmailService) SendEmail

func (s *EmailService) SendEmail(
	ctx context.Context,
	address core.EmailAddress,
	subject string,
	template *templ.Component,
	plaintextMessage string,
) error

SendEmail will build and send a basic e-mail message containing both a HTML template version (optional) as well as a plaintext alternative (required). This will open a new server connection and immediately close it after sending the e-mail.

func (*EmailService) SendEmailWithExtraHeaders

func (s *EmailService) SendEmailWithExtraHeaders(
	ctx context.Context,
	address core.EmailAddress,
	subject string,
	template *templ.Component,
	plaintextMessage string,
	extraHeaders []EmailHeader,
) error

func (*EmailService) SendNotification

func (s *EmailService) SendNotification(
	ctx context.Context,
	subject string,
	message string,
	args ...any,
) error

SendNotification will send a specific plain-text notification to the configured notification address.

func (*EmailService) SendRawMessage

func (s *EmailService) SendRawMessage(
	_ context.Context,
	message *gomail.Message,
) error

SendRawMessage will send a raw gomail message using the existing smtp connection. Note that this overrides the "From" header to use the configured value. This will open a new server connection and immediately close it after sending the e-mail.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL