package mail
import "github.com/gobuffalo/buffalo/mail"
Index ¶
- type Attachment
- type BatchSender
- type Body
- type Message
- func New(c buffalo.Context) Message
- func NewFromData(data render.Data) Message
- func NewMessage() Message
- func (m *Message) AddAttachment(name, contentType string, r io.Reader) error
- func (m *Message) AddBodies(data render.Data, renderers ...render.Renderer) error
- func (m *Message) AddBody(r render.Renderer, data render.Data) error
- func (m *Message) AddEmbedded(name string, r io.Reader) error
- func (m *Message) SetHeader(field, value string)
- type SMTPSender
- func NewSMTPSender(host string, port string, user string, password string) (SMTPSender, error)
- func (sm SMTPSender) Send(message Message) error
- func (sm SMTPSender) SendBatch(messages ...Message) (errorsByMessages []error, generalError error)
- type Sender
Types ¶
type Attachment ¶
Attachment are files added into a email message
type BatchSender ¶
type BatchSender interface { Sender SendBatch(messages ...Message) (errorsByMessages []error, generalError error) }
BatchSender interface for sending batch or single mail
type Body ¶
Body represents one of the bodies in the Message could be main or alternative
type Message ¶
type Message struct { Context context.Context From string To []string CC []string Bcc []string Subject string Headers map[string]string Data render.Data Bodies []Body Attachments []Attachment // contains filtered or unexported fields }
Message represents an Email message
func New ¶
New builds a new message with the current buffalo.Context
func NewFromData ¶
NewFromData builds a new message with raw template data given
func NewMessage ¶
func NewMessage() Message
NewMessage builds a new message.
func (*Message) AddAttachment ¶
AddAttachment adds the attachment to the list of attachments the Message has.
func (*Message) AddBodies ¶
AddBodies Allows to add multiple bodies to the message, it returns errors that could happen in the rendering.
func (*Message) AddBody ¶
AddBody the message by receiving a renderer and rendering data, first message will be used as the main message Body rest of them will be passed as alternative bodies on the email message
func (*Message) AddEmbedded ¶
AddEmbedded adds the attachment to the list of attachments the Message has and uses inline instead of attachement property.
func (*Message) SetHeader ¶
SetHeader sets the heder field and value for the message
type SMTPSender ¶
SMTPSender allows to send Emails by connecting to a SMTP server.
func NewSMTPSender ¶
NewSMTPSender builds a SMTP mail based in passed config.
func (SMTPSender) Send ¶
func (sm SMTPSender) Send(message Message) error
Send a message using SMTP configuration or returns an error if something goes wrong.
func (SMTPSender) SendBatch ¶
func (sm SMTPSender) SendBatch(messages ...Message) (errorsByMessages []error, generalError error)
SendBatch of message with one connection, returns general error or errors specific for each message
type Sender ¶
Sender interface for any upcoming mailers.
Source Files ¶
attachment.go body.go mail.go message.go sender.go smtp_sender.go
Directories ¶
Path | Synopsis |
---|---|
mail/internal |
- Version
- v1.1.2 (latest)
- Published
- May 17, 2025
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 1 week ago –
Tools for package owners.