gophish: github.com/gophish/gophish/mailer Index | Files

package mailer

import "github.com/gophish/gophish/mailer"

Index

Package Files

mailer.go mockmailer.go

Variables

var MaxReconnectAttempts = 10

MaxReconnectAttempts is the maximum number of times we should reconnect to a server

type Dialer Uses

type Dialer interface {
    Dial() (Sender, error)
}

Dialer dials to an SMTP server and returns the SendCloser

type ErrMaxConnectAttempts Uses

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

ErrMaxConnectAttempts is thrown when the maximum number of reconnect attempts is reached.

func (*ErrMaxConnectAttempts) Error Uses

func (e *ErrMaxConnectAttempts) Error() string

Error returns the wrapped error response

type Mail Uses

type Mail interface {
    Backoff(reason error) error
    Error(err error) error
    Success() error
    Generate(msg *gomail.Message) error
    GetDialer() (Dialer, error)
}

Mail is an interface that handles the common operations for email messages

type MailWorker Uses

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

MailWorker is the worker that receives slices of emails on a channel to send. It's assumed that every slice of emails received is meant to be sent to the same server.

func NewMailWorker Uses

func NewMailWorker() *MailWorker

NewMailWorker returns an instance of MailWorker with the mail queue initialized.

func (*MailWorker) Queue Uses

func (mw *MailWorker) Queue(ms []Mail)

Queue sends the provided mail to the internal queue for processing.

func (*MailWorker) Start Uses

func (mw *MailWorker) Start(ctx context.Context)

Start launches the mail worker to begin listening on the Queue channel for new slices of Mail instances to process.

type Mailer Uses

type Mailer interface {
    Start(ctx context.Context)
    Queue([]Mail)
}

Mailer is an interface that defines an object used to queue and send mailer.Mail instances.

type Sender Uses

type Sender interface {
    Send(from string, to []string, msg io.WriterTo) error
    Close() error
    Reset() error
}

Sender exposes the common operations required for sending email.

Package mailer imports 10 packages (graph) and is imported by 21 packages. Updated 2020-05-30. Refresh now. Tools for package owners.