email

package
v0.0.0-...-8495d1f Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToSMTPServer

func ConnectToSMTPServer(config *Config) (net.Conn, error)

ConnectToSMTPServer connects to an SMTP server.

func ConnectToSMTPServerAdvanced

func ConnectToSMTPServerAdvanced(connectionInfo *SMTPConnectionInfo) (net.Conn, error)

ConnectToSMTPServerAdvanced provides advanced SMTP server connection handling.

func NewSMTPClient

func NewSMTPClient(ctx context.Context, conn net.Conn, config *Config) (*smtp.Client, error)

NewSMTPClient returns a new SMTP client.

func NewSMTPClientAdvanced

func NewSMTPClientAdvanced(ctx context.Context, conn net.Conn, hostname string, connectionInfo *SMTPConnectionInfo) (*smtp.Client, error)

NewSMTPClientAdvanced provides an SMTP client.

func SendMail

func SendMail(c smtpClient, mail mailData, date time.Time) error

SendMail sends an email.

func SendMailUsingConfig

func SendMailUsingConfig(to, subject, htmlBody string, sendBcc bool, attachments []*Attachment, config *Config) error

SendMailUsingConfig sends an email with the provided config.

func SendMailWithEmbeddedFilesUsingConfig

func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, sendBcc bool, embeddedFiles map[string]io.Reader, attachments []*Attachment, config *Config) error

SendMailWithEmbeddedFilesUsingConfig sends an email with file attachments.

func TestConnection

func TestConnection(config *Config) error

TestConnection tests the connection to the SMTP server.

Types

type Attachment

type Attachment struct {
	Name     string
	MimeType string
	Data     io.Reader
}

type Config

type Config struct {
	ReplyToName              string
	ReplyToAddress           string
	BCCAddresses             []string
	SMTPUsername             string
	SMTPPassword             string
	SMTPServer               string
	SMTPPort                 string
	SMTPConnectionSecurity   string
	SMTPServerTimeout        int
	SMTPSkipCertVerification bool
}

Config contains SMTP settings for sending emails.

type SMTPConnectionInfo

type SMTPConnectionInfo struct {
	SMTPUsername         string
	SMTPPassword         string
	SMTPServerName       string
	SMTPServerHost       string
	SMTPPort             string
	SMTPServerTimeout    int
	SkipCertVerification bool
	ConnectionSecurity   string
	Auth                 bool
}

SMTPConnectionInfo contains connection information for a SMTP server.

Jump to

Keyboard shortcuts

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