Documentation ¶
Index ¶
- Constants
- Variables
- type Header
- func (h Header) Add(key, value string)
- func (h Header) AddressList(key string) ([]*mail.Address, error)
- func (h Header) Date() (time.Time, error)
- func (h Header) Del(key string)
- func (h Header) Encode(exclude ...string) []byte
- func (h Header) Get(key string) string
- func (h Header) Merge(h2 Header) Header
- func (h Header) Set(key, value string)
- func (h Header) SetAddressList(key string, value []*mail.Address)
- type Mail
- func (m *Mail) AddBcc(address string, name ...string)
- func (m *Mail) AddCc(address string, name ...string)
- func (m *Mail) AddTo(address string, name ...string)
- func (m *Mail) AsSGMailV3() *sgmail.SGMailV3
- func (m *Mail) IsValid() bool
- func (m *Mail) Send(s Sender) error
- func (m *Mail) SetBodyHelper(data []byte, typ string) error
- func (m *Mail) SetBodyHtml(txt string) error
- func (m *Mail) SetBodyText(txt string) error
- func (m *Mail) SetDate(t time.Time)
- func (m *Mail) SetFrom(address string, name ...string)
- func (m *Mail) SetSubject(subject string)
- func (m *Mail) SetTargetHeaders()
- func (m *Mail) WriteTo(w io.Writer) (int64, error)
- type Part
- type RelaySender
- type Sender
- type SendmailSender
Constants ¶
View Source
const ( Mixed = "multipart/mixed" // when adding attachments Alternative = "multipart/alternative" // alternative versions, try to put text/plain first Related = "multipart/related" // when using cid: or Content-ID TypeHTML = "text/html" TypeText = "text/plain" TypeEmail = "message/rfc822" )
Variables ¶
View Source
var ( ErrInvalidEmail = errors.New("email is not valid (missing headers or body)") ErrPartHasNoBody = errors.New("email part has no body (or is already consumed)") )
Functions ¶
This section is empty.
Types ¶
type Mail ¶
type Mail struct { From *mail.Address ReplyTo []*mail.Address To []*mail.Address Cc []*mail.Address Bcc []*mail.Address Body *Part MessageId string }
func (*Mail) AsSGMailV3 ¶ added in v0.1.1
AsSGMailV3 returns a sendgrid SGMailV3 object for this email
func (*Mail) SetBodyHtml ¶
func (*Mail) SetBodyText ¶
func (*Mail) SetDate ¶
SetDate allows changing the date stored in the mail enveloppe. This should not be done normally, but can be useful for unit tests.
func (*Mail) SetSubject ¶
func (*Mail) SetTargetHeaders ¶
func (m *Mail) SetTargetHeaders()
SetTargetHeaders sets the various headers needed for sending the mail based on the values present in Mail This is called automatically when the email is sent and typically doesn't need to be manually called
type Part ¶
type Part struct { Type string // text/plain, etc Children []*Part // only if multipart/* type Data io.ReadCloser GetBody func() (io.ReadCloser, error) Headers Header Boundary string Encoding byte }
func (*Part) IsContainer ¶
func (*Part) IsMultipart ¶
type RelaySender ¶
type RelaySender struct { Host string Port int Auth smtp.Auth TLSConfig *tls.Config RequireTLS bool }
RelaySender sends emails to a relaying server
type Sender ¶
var Sendmail Sender = SendmailSender("/usr/sbin/sendmail")
Click to show internal directories.
Click to hide internal directories.