Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
// Name is the filename of the attachment.
Name string
// Data holds the binary content of the attachment.
Data []byte
}
Attachment represents a file attachment to be sent with an email.
type Emailer ¶
type Emailer interface {
// Send sends an email with the provided details.
//
// Parameters:
// toName: The recipient's name.
// to: The recipient's email address.
// subject: The email subject.
// content: The email body content (can include HTML).
// attachments: A slice of Attachment objects to include with the email.
//
// Returns an error if sending fails.
Send(toName string, to string, subject string, content string, attachments []Attachment) error
}
Emailer defines an interface for sending emails. Implementations should handle constructing and sending emails with optional attachments.
type SendgridApiMail ¶
type SendgridApiMail struct {
// contains filtered or unexported fields
}
SendgridApiMail implements the Emailer interface using SendGrid's API.
func NewSendgridApiMail ¶
func NewSendgridApiMail(apiKey, fromName, from string) *SendgridApiMail
NewSendgridApiMail creates a new SendgridApiMail instance with the provided API key and sender information.
func (*SendgridApiMail) Send ¶
func (s *SendgridApiMail) Send(toName, to, subject, content string, attachments []Attachment) error
Send sends an email using the SendGrid API. It builds a V3Mail object with the given recipient details, subject, content, and attachments.
type SmtpMail ¶
type SmtpMail struct {
// contains filtered or unexported fields
}
SmtpMail implements the Emailer interface using an SMTP server.
Click to show internal directories.
Click to hide internal directories.