mail

package
v1.7.34 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2025 Deirror. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder added in v1.6.6

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

Builder constructs HTML email bodies for verification and notification emails. It holds the base domain used for building verification links.

func NewBuilder added in v1.6.6

func NewBuilder(domain string) *Builder

NewBuilder creates a new Builder with the given domain as the base URL. The domain should include scheme (e.g., https://example.com) and optionally a trailing slash.

func (*Builder) NotifyAccountDeleted added in v1.6.6

func (b *Builder) NotifyAccountDeleted(sysName, support string) string

NotifyAccountDeleted returns an HTML email body notifying the user that their account has been deleted. 'sysName' is the system name, 'support' is the support email for reporting unauthorized deletion.

func (*Builder) NotifyOldEmail added in v1.6.6

func (b *Builder) NotifyOldEmail(sysName, support string) string

NotifyOldEmail returns an HTML email body notifying the user at their old email address that their account email was changed. 'sysName' is the name of the system or application. 'support' is the support email address to contact if the change was unauthorized.

func (*Builder) VerificationChangeEmail added in v1.6.6

func (b *Builder) VerificationChangeEmail(callback, code string) string

VerificationChangeEmail returns an HTML email body for verifying a user's new email address after an email change. 'callback' is the verification endpoint path appended to the domain. 'code' is the unique verification code appended as a query parameter.

func (*Builder) VerificationDeleteAccount added in v1.6.6

func (b *Builder) VerificationDeleteAccount(sysName, support, callback, code string) string

VerificationDeleteAccount returns an HTML email body for verifying a user's account deletion request. 'sysName' is the system name, 'support' is the support email, 'callback' is the endpoint path, and 'code' is the unique verification code.

func (*Builder) VerificationEmail added in v1.6.6

func (b *Builder) VerificationEmail(callback, code string) string

VerificationEmail returns an HTML email body for verifying a user's email address after registration. 'callback' is the verification endpoint path appended to the domain. 'code' is the unique verification code appended as a query parameter.

type Config

type Config struct {
	Host     string // SMTP server host
	Port     string // SMTP server port
	Username string // SMTP username for authentication
	Password string // SMTP password or token for authentication
	From     string // Default "From" email address
}

Config holds SMTP configuration for sending emails.

func NewConfig

func NewConfig(host, port, username, password, from string) *Config

func (*Config) WithFrom

func (c *Config) WithFrom(from string) *Config

WithFrom sets the default "From" email address and returns the updated Config.

func (*Config) WithHost

func (c *Config) WithHost(host string) *Config

WithHost sets the SMTP host and returns the updated Config.

func (*Config) WithPassword

func (c *Config) WithPassword(password string) *Config

WithPassword sets the SMTP password and returns the updated Config.

func (*Config) WithPort

func (c *Config) WithPort(port string) *Config

WithPort sets the SMTP port and returns the updated Config.

func (*Config) WithUsername

func (c *Config) WithUsername(username string) *Config

WithUsername sets the SMTP username and returns the updated Config.

type SMTPClient added in v1.6.6

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

func NewSMTPClient added in v1.6.6

func NewSMTPClient(cfg *Config) (*SMTPClient, error)

func (*SMTPClient) Send added in v1.6.6

func (s *SMTPClient) Send(to, subject, body string) error

type Sender added in v1.6.6

type Sender interface {
	Send(to, subject, body string) error
}

Jump to

Keyboard shortcuts

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