sendmail

package
v0.0.0-...-6ff8b5d Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package sendmail is a generated GoMock package.

Package sendmail is a generated GoMock package.

Index

Constants

View Source
const (
	DEFAULT_SMTP_PORT_STR string = "25"
	TCP_NETWORK           string = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultNetDialerFactory

type DefaultNetDialerFactory struct{}

func (*DefaultNetDialerFactory) NewDialer

func (_ *DefaultNetDialerFactory) NewDialer() INetDialer

type IMailSender

type IMailSender interface {
	LookupMX(ctx context.Context, domain dns.Domain) ([]string, error)
	NewConn(ctx context.Context, hosts []string) (net.Conn, error)
	SendMail(ctx context.Context, conn net.Conn, from smtp.Address, to smtp.Address, msg []byte) error
}

type INetDialer

type INetDialer interface {
	Dial(network, address string) (net.Conn, error)
}

type INetDialerFactory

type INetDialerFactory interface {
	NewDialer() INetDialer
}

func NewDefaultDialerFactory

func NewDefaultDialerFactory() INetDialerFactory

type IResolver

type IResolver interface {
	LookupMX(ctx context.Context, name string) ([]*net.MX, adns.Result, error)
}

type MXRecord

type MXRecord struct {
	ADNSResult adns.Result
	Domain     string
	Entries    []*net.MX
	Hosts      []string
}

type MailSender

type MailSender struct {
	CachedMX      map[string]MXRecord
	DialerFactory INetDialerFactory
	Resolver      IResolver
	Slogger       *slog.Logger
	SmtpOpts      smtpclient.Opts
}

func NewMailSender

func NewMailSender(
	ctx context.Context,
	dialerFactory INetDialerFactory,
	resolver IResolver,
	slogger *slog.Logger,
) *MailSender

func (*MailSender) LookupMX

func (m *MailSender) LookupMX(
	ctx context.Context,
	domain dns.Domain,
) ([]string, error)

func (*MailSender) NewConn

func (m *MailSender) NewConn(
	ctx context.Context,
	hosts []string,
) (net.Conn, error)

func (*MailSender) SendMail

func (m *MailSender) SendMail(
	ctx context.Context,
	conn net.Conn,
	from smtp.Address,
	to smtp.Address,
	msg []byte,
) error

type MockIMailSender

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

MockIMailSender is a mock of IMailSender interface.

func NewMockIMailSender

func NewMockIMailSender(ctrl *gomock.Controller) *MockIMailSender

NewMockIMailSender creates a new mock instance.

func (*MockIMailSender) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIMailSender) LookupMX

func (m *MockIMailSender) LookupMX(ctx context.Context, domain dns.Domain) ([]string, error)

LookupMX mocks base method.

func (*MockIMailSender) NewConn

func (m *MockIMailSender) NewConn(ctx context.Context, hosts []string) (net.Conn, error)

NewConn mocks base method.

func (*MockIMailSender) SendMail

func (m *MockIMailSender) SendMail(ctx context.Context, conn net.Conn, from, to smtp.Address, msg []byte) error

SendMail mocks base method.

type MockIMailSenderMockRecorder

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

MockIMailSenderMockRecorder is the mock recorder for MockIMailSender.

func (*MockIMailSenderMockRecorder) LookupMX

func (mr *MockIMailSenderMockRecorder) LookupMX(ctx, domain any) *gomock.Call

LookupMX indicates an expected call of LookupMX.

func (*MockIMailSenderMockRecorder) NewConn

func (mr *MockIMailSenderMockRecorder) NewConn(ctx, hosts any) *gomock.Call

NewConn indicates an expected call of NewConn.

func (*MockIMailSenderMockRecorder) SendMail

func (mr *MockIMailSenderMockRecorder) SendMail(ctx, conn, from, to, msg any) *gomock.Call

SendMail indicates an expected call of SendMail.

type MockINetDialer

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

MockINetDialer is a mock of INetDialer interface.

func NewMockINetDialer

func NewMockINetDialer(ctrl *gomock.Controller) *MockINetDialer

NewMockINetDialer creates a new mock instance.

func (*MockINetDialer) Dial

func (m *MockINetDialer) Dial(network, address string) (net.Conn, error)

Dial mocks base method.

func (*MockINetDialer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockINetDialerFactory

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

MockINetDialerFactory is a mock of INetDialerFactory interface.

func NewMockINetDialerFactory

func NewMockINetDialerFactory(ctrl *gomock.Controller) *MockINetDialerFactory

NewMockINetDialerFactory creates a new mock instance.

func (*MockINetDialerFactory) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockINetDialerFactory) NewDialer

func (m *MockINetDialerFactory) NewDialer() INetDialer

NewDialer mocks base method.

type MockINetDialerFactoryMockRecorder

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

MockINetDialerFactoryMockRecorder is the mock recorder for MockINetDialerFactory.

func (*MockINetDialerFactoryMockRecorder) NewDialer

NewDialer indicates an expected call of NewDialer.

type MockINetDialerMockRecorder

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

MockINetDialerMockRecorder is the mock recorder for MockINetDialer.

func (*MockINetDialerMockRecorder) Dial

func (mr *MockINetDialerMockRecorder) Dial(network, address any) *gomock.Call

Dial indicates an expected call of Dial.

type MockIResolver

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

MockIResolver is a mock of IResolver interface.

func NewMockIResolver

func NewMockIResolver(ctrl *gomock.Controller) *MockIResolver

NewMockIResolver creates a new mock instance.

func (*MockIResolver) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIResolver) LookupMX

func (m *MockIResolver) LookupMX(ctx context.Context, name string) ([]*net.MX, adns.Result, error)

LookupMX mocks base method.

type MockIResolverMockRecorder

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

MockIResolverMockRecorder is the mock recorder for MockIResolver.

func (*MockIResolverMockRecorder) LookupMX

func (mr *MockIResolverMockRecorder) LookupMX(ctx, name any) *gomock.Call

LookupMX indicates an expected call of LookupMX.

Jump to

Keyboard shortcuts

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