Documentation
¶
Overview ¶
Package smtp provides implementations of services for sending e-mails using an SMTP server
Index ¶
- type EmailHeader
- type EmailService
- func (s *EmailService) SendEmail(ctx context.Context, address core.EmailAddress, subject string, ...) error
- func (s *EmailService) SendEmailWithExtraHeaders(ctx context.Context, address core.EmailAddress, subject string, ...) error
- func (s *EmailService) SendNotification(ctx context.Context, subject string, message string, args ...any) error
- func (s *EmailService) SendRawMessage(_ context.Context, message *gomail.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailHeader ¶
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
func NewEmailService ¶
func NewEmailService(cfg config.EmailConfig) (*EmailService, error)
func (*EmailService) SendEmail ¶
func (s *EmailService) SendEmail( ctx context.Context, address core.EmailAddress, subject string, template *templ.Component, plaintextMessage string, ) error
SendEmail will build and send a basic e-mail message containing both a HTML template version (optional) as well as a plaintext alternative (required). This will open a new server connection and immediately close it after sending the e-mail.
func (*EmailService) SendEmailWithExtraHeaders ¶
func (s *EmailService) SendEmailWithExtraHeaders( ctx context.Context, address core.EmailAddress, subject string, template *templ.Component, plaintextMessage string, extraHeaders []EmailHeader, ) error
func (*EmailService) SendNotification ¶
func (s *EmailService) SendNotification( ctx context.Context, subject string, message string, args ...any, ) error
SendNotification will send a specific plain-text notification to the configured notification address.
func (*EmailService) SendRawMessage ¶
SendRawMessage will send a raw gomail message using the existing smtp connection. Note that this overrides the "From" header to use the configured value. This will open a new server connection and immediately close it after sending the e-mail.