email

package module
v0.0.0-...-b758e09 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 9 Imported by: 0

README

Email

Email is important when you want to improve user engagement on your application. This functionality will keep up-to-date your users about your application.

Amazon SES is a cloud email service provider that can integrate into any application for bulk email sending. Whether you use email software to send transactional emails, marketing emails, or newsletter emails, you pay only for what you use.

Steps to use email-reusables

  • We have used go.embed to parse email templates for emails

Prerequisites

  • Email template in templates directory of your project's root.
  • AWS credentials
    • Access key id
    • Secret Access key
    • Region
    • AWS session token (If MFA enabled for AWS account)

Example

Find a working example of Email-reusable at Email-Example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAWSSession

func CreateAWSSession(creds Credentials) (*session.Session, error)

func SendAWSSESEmail

func SendAWSSESEmail(sess *session.Session, data *EmailData) (bool, error)

Types

type Credentials

type Credentials struct {
	Region          string
	AccessKeyId     string
	SecretAccessKey string
	Token           string
}

type EmailData

type EmailData struct {
	// title of email
	Title string

	// sender's email address
	Sender string

	// Receiver's email address
	Receiver string

	// Email charset
	Charset string

	// Embeded template
	TemplateFs embed.FS

	// Tempalte patterns from embed like templates/*.html
	TemplatePatterns string

	// Email template name without path
	TemplateName string

	// Attachment bytes if any
	FileBytes *bytes.Buffer

	// Attachment file name.
	// It should be with extension
	FileName string

	// Data for email body
	Input interface{}
}

Jump to

Keyboard shortcuts

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