Spaces:
Paused
Paused
File size: 517 Bytes
83a59ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | package emails
import (
"context"
"fmt"
"strings"
)
// Email represents an email message
type Email struct {
ToName string
ToEmail string
Subject string
HTML string
Text string
}
func (mail *Email) toAddress() string {
if strings.TrimSpace(mail.ToName) != "" {
return fmt.Sprintf("%s <%s>", mail.ToName, mail.ToEmail)
}
return mail.ToEmail
}
// Mailer is used for sending emails
type Mailer interface {
// Send adds a message to the push queue
Send(ctx context.Context, mail *Email) error
}
|