mail

package
v0.0.0-...-45c4399 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMailer

func NewMailer(db CommunicationDal, m MailApi, config config.Config) *mailer

Types

type CommunicationDal

type CommunicationDal interface {
	GetMemberByEmail(memberEmail string) (models.Member, error)
	GetCommunication(communication string) (models.Communication, error)
	LogCommunication(communicationId int, memberId string) error
	GetMostRecentCommunicationToMember(memberId string, commId int) (time.Time, error)
}

type CommunicationTemplate

type CommunicationTemplate string
const (
	AccessRevokedMember         CommunicationTemplate = "AccessRevokedMember"
	AccessRevokedLeadership     CommunicationTemplate = "AccessRevokedLeadership"
	IpChanged                   CommunicationTemplate = "IpChanged"
	PendingRevokationLeadership CommunicationTemplate = "PendingRevokationLeadership"
	PendingRevokationMember     CommunicationTemplate = "PendingRevokationMember"
	Welcome                     CommunicationTemplate = "Welcome"
)

func (CommunicationTemplate) String

func (c CommunicationTemplate) String() string

String converts CommunicationTemplate to a string

type MailApi

type MailApi interface {
	SendHtmlMail(address, subject, body string) (string, error)
	SendPlainTextMail(address, subject, content string) (string, error)
}

type Provider

type Provider struct {
	URL string
	Key string
	// contains filtered or unexported fields
}

Provider has config information for connecting to mailgun

func Setup

func Setup() (*Provider, error)

Setup attaches config information to mailProvider object

func (Provider) SendHtmlMail

func (mp Provider) SendHtmlMail(address, subject, html string) (string, error)

func (Provider) SendPlainTextMail

func (mp Provider) SendPlainTextMail(address, subject, text string) (string, error)

func (Provider) SendSMTP

func (mp Provider) SendSMTP(address, subject, text string) (string, error)

SendSMTP - send a simple email via smtp

Jump to

Keyboard shortcuts

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