[#1069] added default Message-ID and more options to customize the mail message

This commit is contained in:
Gani Georgiev
2022-11-21 14:53:05 +02:00
parent c4a660d2d2
commit 3e1a19685b
11 changed files with 186 additions and 157 deletions
+15 -8
View File
@@ -5,14 +5,21 @@ import (
"net/mail"
)
// 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
}
// Mailer defines a base mail client interface.
type Mailer interface {
// Send sends an email with HTML body to the specified recipient.
Send(
fromEmail mail.Address,
toEmail mail.Address,
subject string,
htmlContent string,
attachments map[string]io.Reader,
) error
// Send sends an email with the provided Message.
Send(message *Message) error
}