mail

package
v5.39.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: AGPL-3.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TLS      = "TLS"
	StartTLS = "STARTTLS"
)
View Source
const (
	InbucketAPI = "/api/v1/mailbox/"
)

Variables

This section is empty.

Functions

func ConnectToSMTPServer

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

func ConnectToSMTPServerAdvanced

func ConnectToSMTPServerAdvanced(config *SMTPConfig) (net.Conn, error)

func DeleteMailBox

func DeleteMailBox(email string) (err error)

func LoginAuth

func LoginAuth(username, password, host string) smtp.Auth

func NewSMTPClient

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

func NewSMTPClientAdvanced

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

func ParseEmail

func ParseEmail(email string) string

func RetryInbucket

func RetryInbucket(attempts int, callback func() error) (err error)

func SendMail

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

func SendMailUsingConfig

func SendMailUsingConfig(to, subject, htmlBody string, config *SMTPConfig, enableComplianceFeatures bool, ccMail string) error

func SendMailWithEmbeddedFilesUsingConfig

func SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody string, embeddedFiles map[string]io.Reader, config *SMTPConfig, enableComplianceFeatures bool, ccMail string) error

func TestConnection

func TestConnection(config *SMTPConfig) error

Types

type JSONMessageHeaderInbucket

type JSONMessageHeaderInbucket []struct {
	Mailbox             string
	ID                  string `json:"Id"`
	From, Subject, Date string
	To                  []string
	Size                int
}

OutputJSONHeader holds the received Header to test sending emails (inbucket)

func GetMailBox

func GetMailBox(email string) (results JSONMessageHeaderInbucket, err error)

type JSONMessageInbucket

type JSONMessageInbucket struct {
	Mailbox             string
	ID                  string `json:"Id"`
	From, Subject, Date string
	Size                int
	Header              map[string][]string
	Body                struct {
		Text string
		HTML string `json:"Html"`
	}
	Attachments []struct {
		Filename     string
		ContentType  string `json:"content-type"`
		DownloadLink string `json:"download-link"`
		Bytes        []byte `json:"-"`
	}
}

OutputJSONMessage holds the received Message fto test sending emails (inbucket)

func GetMessageFromMailbox

func GetMessageFromMailbox(email, id string) (JSONMessageInbucket, error)

type SMTPConfig

type SMTPConfig struct {
	ConnectionSecurity                string
	SkipServerCertificateVerification bool
	Hostname                          string
	ServerName                        string
	Server                            string
	Port                              string
	ServerTimeout                     int
	Username                          string
	Password                          string
	EnableSMTPAuth                    bool
	SendEmailNotifications            bool
	FeedbackName                      string
	FeedbackEmail                     string
	ReplyToAddress                    string
}

Jump to

Keyboard shortcuts

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