mailservice

package
v5.6.1-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: AGPL-3.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INBUCKET_API = "/api/v1/mailbox/"
)

Variables

This section is empty.

Functions

func ConnectToSMTPServer

func ConnectToSMTPServer(config *model.Config) (net.Conn, *model.AppError)

func ConnectToSMTPServerAdvanced

func ConnectToSMTPServerAdvanced(connectionInfo *SmtpConnectionInfo) (net.Conn, *model.AppError)

func DeleteMailBox

func DeleteMailBox(email string) (err error)

func LoginAuth

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

func NewSMTPClient

func NewSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.AppError)

func NewSMTPClientAdvanced

func NewSMTPClientAdvanced(conn net.Conn, hostname string, connectionInfo *SmtpConnectionInfo) (*smtp.Client, *model.AppError)

func ParseEmail

func ParseEmail(email string) string

func RetryInbucket

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

func SendMail

func SendMail(c *smtp.Client, mimeTo, smtpTo string, from mail.Address, subject, htmlBody string, attachments []*model.FileInfo, mimeHeaders map[string]string, fileBackend filesstore.FileBackend, date time.Time) *model.AppError

func SendMailUsingConfig

func SendMailUsingConfig(to, subject, htmlBody string, config *model.Config, enableComplianceFeatures bool) *model.AppError

func SendMailUsingConfigAdvanced

func SendMailUsingConfigAdvanced(mimeTo, smtpTo string, from mail.Address, subject, htmlBody string, attachments []*model.FileInfo, mimeHeaders map[string]string, config *model.Config, enableComplianceFeatures bool) *model.AppError

allows for sending an email with attachments and differing MIME/SMTP recipients

func TestConnection

func TestConnection(config *model.Config)

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) (results JSONMessageInbucket, err error)

type SmtpConnectionInfo

type SmtpConnectionInfo struct {
	SmtpUsername         string
	SmtpPassword         string
	SmtpServerName       string
	SmtpServerHost       string
	SmtpPort             string
	SkipCertVerification bool
	ConnectionSecurity   string
	Auth                 bool
}

Jump to

Keyboard shortcuts

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