buffalo: github.com/gobuffalo/buffalo/mail Index | Files | Directories

package mail

import "github.com/gobuffalo/buffalo/mail"

Index

Package Files

attachment.go body.go mail.go message.go sender.go smtp_sender.go

type Attachment Uses

type Attachment struct {
    Name        string
    Reader      io.Reader
    ContentType string
    Embedded    bool
}

Attachment are files added into a email message

type Body Uses

type Body struct {
    Content     string
    ContentType string
}

Body represents one of the bodies in the Message could be main or alternative

type Message Uses

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 Uses

func New(c buffalo.Context) Message

New builds a new message with the current buffalo.Context

func NewFromData Uses

func NewFromData(data render.Data) Message

NewFromData builds a new message with raw template data given

func NewMessage Uses

func NewMessage() Message

NewMessage builds a new message.

func (*Message) AddAttachment Uses

func (m *Message) AddAttachment(name, contentType string, r io.Reader) error

AddAttachment adds the attachment to the list of attachments the Message has.

func (*Message) AddBodies Uses

func (m *Message) AddBodies(data render.Data, renderers ...render.Renderer) error

AddBodies Allows to add multiple bodies to the message, it returns errors that could happen in the rendering.

func (*Message) AddBody Uses

func (m *Message) AddBody(r render.Renderer, data render.Data) error

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 Uses

func (m *Message) AddEmbedded(name string, r io.Reader) error

AddEmbedded adds the attachment to the list of attachments the Message has and uses inline instead of attachement property.

func (*Message) SetHeader Uses

func (m *Message) SetHeader(field, value string)

SetHeader sets the heder field and value for the message

type SMTPSender Uses

type SMTPSender struct {
    Dialer *gomail.Dialer
}

SMTPSender allows to send Emails by connecting to a SMTP server.

func NewSMTPSender Uses

func NewSMTPSender(host string, port string, user string, password string) (SMTPSender, error)

NewSMTPSender builds a SMTP mail based in passed config.

func (SMTPSender) Send Uses

func (sm SMTPSender) Send(message Message) error

Send a message using SMTP configuration or returns an error if something goes wrong.

type Sender Uses

type Sender interface {
    Send(Message) error
}

Sender interface for any upcoming mailers.

Directories

PathSynopsis
internal/mailPackage gomail provides a simple interface to compose emails and to mail them efficiently.

Package mail imports 9 packages (graph) and is imported by 5 packages. Updated 2019-11-01. Refresh now. Tools for package owners.