20 lines
334 B
Go
20 lines
334 B
Go
package mailer
|
|
|
|
import (
|
|
"context"
|
|
|
|
"trustcontact/internal/config"
|
|
)
|
|
|
|
type Mailer interface {
|
|
Send(ctx context.Context, to, subject, htmlBody, textBody string) error
|
|
}
|
|
|
|
func NewMailer(cfg *config.Config) (Mailer, error) {
|
|
if cfg.Env == config.EnvDevelop {
|
|
return NewSinkMailer(cfg.EmailSinkDir)
|
|
}
|
|
|
|
return NewSMTPMailer(cfg)
|
|
}
|