Documentation
¶
Overview ¶
Package postfix is for sending mail
import (
"github.com/vanng822/postfix"
)
fromAddr := postfix.NewAddress(from, fromEmail) toAddr := postfix.NewAddress(to, toEmail) msg, err := postfix.MultipartMessage(fromAddr, toAddr, subject, text, html)
if err != nil {
log.Fatal("Postfix mailing with error", err)
}
err := postfix.Send(msg)
if err != nil {
log.Fatal("Postfix mailing with error", err)
}
Index ¶
- func Hello() error
- func MultipartMessage(from *mail.Address, to *mail.Address, subject, text, html string, ...) (*mail.Message, error)
- func NewAddress(name, address string) *mail.Address
- func Noop() error
- func Send(msg *mail.Message) error
- func SetClientFactory(f func() (c *smtp.Client, err error))
- func SetHost(h string)
- func SetPort(p int)
- type Attachment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MultipartMessage ¶
func MultipartMessage(from *mail.Address, to *mail.Address, subject, text, html string, attachments ...*Attachment) (*mail.Message, error)
MultipartMessage create a message with multipart text and html html part is parsed and applied css inline styling
func NewAddress ¶
NewAddress return new mail.Address
func SetClientFactory ¶
SetClientFactory for setting a smtp client if needed
Types ¶
type Attachment ¶ added in v0.8.0
func NewAttachment ¶ added in v0.11.0
func NewAttachment(filename, contentType string, content []byte) *Attachment
Click to show internal directories.
Click to hide internal directories.