2022-07-07 05:19:05 +08:00
|
|
|
package mailer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"net/mail"
|
|
|
|
)
|
|
|
|
|
2022-11-21 20:53:05 +08:00
|
|
|
// Message defines a generic email message struct.
|
|
|
|
type Message struct {
|
|
|
|
From mail.Address
|
|
|
|
To mail.Address
|
|
|
|
Bcc []string
|
|
|
|
Cc []string
|
|
|
|
Subject string
|
|
|
|
HTML string
|
|
|
|
Text string
|
|
|
|
Headers map[string]string
|
|
|
|
Attachments map[string]io.Reader
|
|
|
|
}
|
|
|
|
|
2022-07-07 05:19:05 +08:00
|
|
|
// Mailer defines a base mail client interface.
|
|
|
|
type Mailer interface {
|
2022-11-21 20:53:05 +08:00
|
|
|
// Send sends an email with the provided Message.
|
|
|
|
Send(message *Message) error
|
2022-07-07 05:19:05 +08:00
|
|
|
}
|