Documentation ¶
Overview ¶
Package email provides an easy to use and hard to misuse email API
Index ¶
Constants ¶
View Source
const (
// MaxLineLength is the maximum line length per RFC 2045
MaxLineLength = 76
)
Variables ¶
View Source
var BlocklistBytes []byte
View Source
var ErrMissingBoundary = errors.New("No boundary found for multipart entity")
ErrMissingBoundary is returned when there is no boundary given for a multipart entity
View Source
var ErrMissingContentType = errors.New("No Content-Type found for MIME entity")
ErrMissingContentType is returned when there is no "Content-Type" header for a MIME entity
Functions ¶
func InitDefaultMailer ¶
func InitDefaultMailer(config SMTPConfig)
InitDefaultMailer set the default, global mailer
func IsInBlocklist ¶
Types ¶
type Attachment ¶
type Attachment struct { Filename string Header textproto.MIMEHeader Content []byte }
Attachment is an email attachment. Based on the mime/multipart.FileHeader struct, Attachment contains the name, MIMEHeader, and content of the attachment in question
type Email ¶
type Email struct { ReplyTo []mail.Address From mail.Address To []mail.Address Bcc []mail.Address Cc []mail.Address Subject string Text []byte // Plaintext message HTML []byte // Html message Headers textproto.MIMEHeader Attachments []Attachment }
Email is an email... either Text or HTML must be provided
type Mailer ¶
type Mailer interface { SendTransactionnal(ctx context.Context, email Email) error SendBroadcast(ctx context.Context, email Email) error }
Mailer is the interface defining a service which sends emails
type SMTPConfig ¶
SMTPConfig is used to configure an email
type SMTPMailer ¶
type SMTPMailer struct {
// contains filtered or unexported fields
}
Mailer are used to send email
func NewSMTPMailer ¶
func NewSMTPMailer(config SMTPConfig) SMTPMailer
NewMailer returns a new mailer
Click to show internal directories.
Click to hide internal directories.