email

package
v0.0.0-...-c791c95 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package email provides email sending functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessConfirmEmailFromQueue

func ProcessConfirmEmailFromQueue(paramsJSON []byte) error

ProcessConfirmEmailFromQueue processes the parameters from the queue.

func ProcessResetPasswordEmailFromQueue

func ProcessResetPasswordEmailFromQueue(paramsJSON []byte) error

ProcessResetPasswordEmailFromQueue processes the parameters from the queue.

func ProcessWelcomeEmailFromQueue

func ProcessWelcomeEmailFromQueue(paramsJSON []byte) error

ProcessWelcomeEmailFromQueue processes the parameters from the queue.

func SendTestEmail

func SendTestEmail()

SendTestEmail provides a simple way to test SMTP configuration.

func SetSender

func SetSender(sender *Sender)

SetSender sets the sender.

func Setup

func Setup() error

Setup configures the sender, and declares the queues and consumers.

Types

type ConfirmEmailParams

type ConfirmEmailParams struct {
	ReceipientEmail  string
	UserFirstName    string
	ConfirmationLink string
	EmailFromName    string
}

ConfirmEmailParams holds parameters for the template.

func (*ConfirmEmailParams) AddToQueue

func (params *ConfirmEmailParams) AddToQueue() error

AddToQueue adds the parameters to queue.

func (*ConfirmEmailParams) Send

func (params *ConfirmEmailParams) Send() error

Send generates the email from the parameters and is sent.

type ResetPasswordEmailParams

type ResetPasswordEmailParams struct {
	ReceipientEmail   string
	UserFirstName     string
	ResetPasswordLink string
	EmailFromName     string
}

ResetPasswordEmailParams holds parameters for the template.

func (*ResetPasswordEmailParams) AddToQueue

func (params *ResetPasswordEmailParams) AddToQueue() error

AddToQueue adds the parameters to queue.

func (*ResetPasswordEmailParams) Send

func (params *ResetPasswordEmailParams) Send() error

Send generates the email from the parameters and is sent.

type Sender

type Sender struct {
	SMTPHost     string
	SMTPPort     int
	SMTPUsername string
	SMTPPassword string
	FromAddress  string
	FromName     string
}

Sender holds the SMTP details.

func GetSender

func GetSender() *Sender

GetSender returns a pointer to the sender.

func (*Sender) Send

func (s *Sender) Send(dest []string, content string) error

Send adds the from and to headers and sends the email.

func (*Sender) Write

func (s *Sender) Write(contentType, subject, body string) string

Write returns the string of the composed email.

func (*Sender) WriteHTMLEmail

func (s *Sender) WriteHTMLEmail(subject, body string) string

WriteHTMLEmail returns the HTML composed email.

func (*Sender) WritePlainEmail

func (s *Sender) WritePlainEmail(subject, body string) string

WritePlainEmail returns the plain text composed email.

type WelcomeEmailParams

type WelcomeEmailParams struct {
	ReceipientEmail string
	UserFirstName   string
	EmailFromName   string
}

WelcomeEmailParams holds parameters for the template.

func (*WelcomeEmailParams) AddToQueue

func (params *WelcomeEmailParams) AddToQueue() error

AddToQueue adds the parameters to queue.

func (*WelcomeEmailParams) Send

func (params *WelcomeEmailParams) Send() error

Send generates the email from the parameters and is sent.

Jump to

Keyboard shortcuts

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