email

package
v0.0.0-...-d6ca7af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package email is an email handler used for sending email messages like sign up verifications and password reset requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMailSSL

func SendMailSSL(addr string, auth smtp.Auth, username string, recpts []string, message []byte) error

SendMailSSL dials an SSL connection to send messages.

Types

type Recipient

type Recipient interface {
	GetEmail() string
	Greeting() string
}

Recipient interface represents someone who can receive an email message.

type Sender

type Sender struct {

	// You can include {{.Organization}} in you templates and get the name of the organization in your messages.
	Organization string

	// A function used to send an individual message.
	// This should almost never be used. SendMessage should be used instead.
	SendMail func(string, smtp.Auth, string, []string, []byte) error
	// contains filtered or unexported fields
}

Sender handles all the sending of email messages like password reset and sign up.

func NewSender

func NewSender(organization, hostname, port, username, password string) *Sender

NewSender returns an email handler for sending messages from a single address.

func NewSenderAuth

func NewSenderAuth(organization, hostname, port, email string, auth smtp.Auth) *Sender

NewSenderAuth returns an email handler for sending messages from a single address provided an smtp.Auth.

func (*Sender) SendMessage

func (e *Sender) SendMessage(tmpl *template.Template, subject string, data map[string]interface{}, recipientList ...Recipient) error

SendMessage sends the message (as an HTML template) to the recipients Then template may include .Greeting or .Email for the information for the corresponding recipient.

func (*Sender) SendPasswordResetMessage

func (e *Sender) SendPasswordResetMessage(temp *template.Template, receiver Recipient, resetURL string) error

SendPasswordResetMessage sends a password reset message to the given email address.

func (*Sender) SendSignUpMessage

func (e *Sender) SendSignUpMessage(temp *template.Template, receiver Recipient, resetURL string) error

SendSignUpMessage sends a password reset message to the given email address.

Directories

Path Synopsis
Package smtpauth provides implementations of the smtp.Auth interface for sending messages with the LOGIN authentication mechanism, only allowed of SSL/TLS connections.
Package smtpauth provides implementations of the smtp.Auth interface for sending messages with the LOGIN authentication mechanism, only allowed of SSL/TLS connections.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL