Documentation ¶
Overview ¶
Package sendmail implements then classic method of sending emails, well known from PHP.
Index ¶
- Constants
- func Validate(email string) error
- type Mail
- func (m *Mail) AppendBCC(bccAddress ...*mail.Address) *Mail
- func (m *Mail) AppendCC(ccAddress ...*mail.Address) *Mail
- func (m *Mail) AppendTo(toAddress ...*mail.Address) *Mail
- func (m *Mail) Send() error
- func (m *Mail) SetDebug(active bool) *Mail
- func (m *Mail) SetDebugOutput(w io.Writer) *Mail
- func (m *Mail) SetFrom(fromAddress *mail.Address) *Mail
- func (m *Mail) SetSendmail(path string, args ...string) *Mail
- func (m *Mail) SetSubject(subject string) *Mail
- func (m *Mail) WriteTo(wr io.Writer) (n int64, err error)
- type Option
Constants ¶
const SendmailDefault = "/usr/sbin/sendmail"
SendmailDefault points to the default sendmail binary location.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mail ¶
type Mail struct { Subject string From *mail.Address To []*mail.Address CC []*mail.Address BCC []*mail.Address Header http.Header Text bytes.Buffer HTML bytes.Buffer // contains filtered or unexported fields }
Mail defines basic mail structure and headers
func (*Mail) Send ¶
Send sends an email, or prints it on stderr, when environment variable `DEBUG` is set.
func (*Mail) SetDebug ¶
SetDebug sets the debug output to stderr if active is true, else it removes the debug output. Use SetDebugOutput to set it to something else.
func (*Mail) SetDebugOutput ¶
SetDebugOutput sets the debug output to the given writer. If w is nil, this is equivalent to SetDebug(false).
func (*Mail) SetSendmail ¶
SetSendmail modifies the path to the sendmail binary. You can pass additional arguments, if you need to.
func (*Mail) SetSubject ¶
SetSubject sets the mail subject.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used in the Mail constructor.
func Debug ¶
Debug sets the debug output to stderr if active is true, else it removes the debug output. Use SetDebugOutput to set it to something else.
func DebugOutput ¶
DebugOutput sets the debug output to the given writer. If w is nil, this is equivalent to SetDebug(false).