Documentation
¶
Overview ¶
Package mail sends plain-text email over SMTP. Auth uses it to deliver one-time login codes; the Sender interface lets tests substitute a fake.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SMTPSender ¶
SMTPSender sends through a single SMTP server. Port 465 uses implicit TLS; any other port uses STARTTLS when the server offers it. PLAIN auth is used only when User is set, so an unauthenticated local relay works.
func NewSMTPSenderFromEnv ¶
func NewSMTPSenderFromEnv() (*SMTPSender, bool)
NewSMTPSenderFromEnv builds a sender from smtp_host, smtp_port (default 587), smtp_user, smtp_password and smtp_from. ok is false when smtp_host or smtp_from is unset, meaning email login is not configured.
func (*SMTPSender) Send ¶
func (s *SMTPSender) Send(to, subject, body string) error
Send delivers one message to a single recipient.
Click to show internal directories.
Click to hide internal directories.