email

package
v0.0.1-20260222-200821... Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServer

func AddServer(name, smtpHost string, smtpPort int, imapHost string, imapPort int)

AddServer allows adding custom provider configuration for both SMTP and IMAP.

Types

type ClientOptions

type ClientOptions struct {
	Type      string
	Host      string
	Port      int
	Username  string
	Password  string //#nosec
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

ClientOptions holds the configuration for the email client

type EmailClient

type EmailClient interface {
	Send(data *EmailData) error
}

func NewGomailClient

func NewGomailClient(opts ...Option) (EmailClient, error)

NewGomailClient creates a new gomail client @param opts: The options for the gomail client @return: The gomail client @return: The error if any must provide logger

func NewSESClient

func NewSESClient(awsManager *aws.AWSManager, opts ...Option) (EmailClient, error)

NewSESClient creates a new SES email client using an existing AWSManager

type EmailData

type EmailData struct {
	FromName     string
	From         string
	To           []string
	CC           []string
	BCC          []string
	Subject      string
	TextBody     string
	HTMLBody     string
	Attachments  []string // supports local paths or URLs
	TemplateData map[string]string
	// Custom headers if needed
	Headers map[string]string
}

EmailData represents the data for an email message This is the data that is passed to the email client to send an email @field From: The sender's email address <No Reply <email>> @field To: The recipient's email address <email> @field CC: The carbon copy recipients' email addresses <email> @field BCC: The blind carbon copy recipients' email addresses <email> @field Subject: The subject of the email <string> @field TextBody: The body of the email in plain text <string> @field HTMLBody: The body of the email in HTML <string> @field Attachments: The attachments to be sent with the email <string> @field TemplateData: The data to be used for templating <map[string]string> @field Headers: The custom headers to be added to the email <map[string]string>

func NewEmailData

func NewEmailData() *EmailData

type GomailClient

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

func (*GomailClient) Send

func (c *GomailClient) Send(data *EmailData) error

type MailServerConfig

type MailServerConfig struct {
	SMTPHost string
	SMTPPort int
	IMAPHost string
	IMAPPort int
}

MailServerConfig holds the complete configuration for both SMTP (sending) and IMAP (receiving) services for an email provider.

func GetServer

func GetServer(provider string) (MailServerConfig, error)

GetServer gets the complete mail server config for a provider (SMTP and IMAP). The function name GetServer is maintained for backward compatibility with the original intent.

type Option

type Option func(*ClientOptions)

func WithClientType

func WithClientType(clientType string) Option

WithClientType sets the client type for the email client @param clientType: The client type for the email client

func WithCredentials

func WithCredentials(username, password string) Option

WithCredentials sets the username and password for the email client @param username: The username or email for the email client @param password: The password for the email client

func WithHost

func WithHost(host string) Option

WithHost sets the host for the email client

func WithLog

func WithLog(log *log.Log) Option

WithLog sets the log for the email client

func WithPort

func WithPort(port int) Option

WithPort sets the port for the email client

func WithTLSConfig

func WithTLSConfig(config *tls.Config) Option

WithTLSConfig sets the TLS configuration for the email client @param config: The TLS configuration for the email client

type SESClient

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

SESClient is an email client that uses AWS SES via AWSManager

func (*SESClient) Send

func (c *SESClient) Send(data *EmailData) error

Send sends an email using AWS SES

Jump to

Keyboard shortcuts

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