Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingContent is used when sending an email without parts ErrMissingContent = errors.New("emailer: missing content") // ErrMissingSubject is used when sending an email without subject ErrMissingSubject = errors.New("emailer: missing subject") // ErrMissingTemplate is used when sending an email without a template name // or template values ErrMissingTemplate = errors.New("emailer: missing template") )
Functions ¶
func SendEmail
deprecated
func SendEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error
SendEmail send a mail to the instance owner.
Deprecated: use EmailerService.SendEmail instead.
Types ¶
type CampaignEmailCmd ¶
CampaignEmailCmd contains the information required to send a campaign email to the instance owner.
type Emailer ¶
type Emailer interface { SendEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error SendPendingEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error SendCampaignEmail(inst *instance.Instance, cmd *CampaignEmailCmd) error }
Emailer allows to send a pre-formatted email to an instance owner.
This interface has several implementations: - EmailerService sending email via an async job - Mock with a mock implementation
type EmailerService ¶
type EmailerService struct {
// contains filtered or unexported fields
}
EmailerService allows to send emails.
This broker send the emails via anrasynchronous job.
func Init ¶
func Init() *EmailerService
Init the emailer package by setting up a service based on the global config and setup the global functions.
func NewEmailerService ¶
func NewEmailerService(jobBroker job.Broker) *EmailerService
NewEmailerService instantiates an EmailerService.
func (*EmailerService) SendCampaignEmail ¶
func (s *EmailerService) SendCampaignEmail(inst *instance.Instance, cmd *CampaignEmailCmd) error
SendCampaignEmail sends a campaign email to the instance owner with the given cmd content via the dedicated campaign mail server.
func (*EmailerService) SendEmail ¶
func (s *EmailerService) SendEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error
SendEmail sends a mail to the instance owner.
func (*EmailerService) SendPendingEmail ¶
func (s *EmailerService) SendPendingEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error
SendPendingEmail sends a mail to the instance owner on their new pending email address. It is used to confirm that they can receive emails on the new email address.
type Mock ¶
Mock implementation of Emailer.
func (*Mock) SendCampaignEmail ¶
func (m *Mock) SendCampaignEmail(inst *instance.Instance, cmd *CampaignEmailCmd) error
SendCampaignEmail mock method
func (*Mock) SendEmail ¶
func (m *Mock) SendEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error
SendEmail mock method.
func (*Mock) SendPendingEmail ¶
func (m *Mock) SendPendingEmail(inst *instance.Instance, cmd *TransactionalEmailCmd) error
SendPendingEmail mock method.
type TransactionalEmailCmd ¶
TransactionalEmailCmd contains the information to send a transactional email to the instance owner.