sgrid

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mail

type Mail struct {
	From    string
	To      string
	Subject string
	Body    string
	Data    *MailData
}

Email request struct

type MailData

type MailData struct {
	Username string
	Code     string
}

Structure of the data to be used in the template of the mail

type MailService

type MailService interface {
	NewMail(from string, to string, subject string, body string, data *MailData) *Mail
	SendMail(mailreq *Mail) error
}

Sendgrid interface

type SGMailService

type SGMailService struct {
	Logger log.Logger
	Client *sendgrid.Client
}

Sendgrid implementation of mailservice

func NewSGMailService

func NewSGMailService(logger log.Logger) *SGMailService

Returns a new instance of SGMailService

func (*SGMailService) NewMail

func (ms *SGMailService) NewMail(from string, to string, subject, body string, data *MailData) *Mail

NewMail returns a new mail request

func (*SGMailService) SendMail

func (ms *SGMailService) SendMail(mailReq *Mail) error

CreateMail takes in mail request, and constructs a sendgrid mail type

type Service

type Service interface {
	SendMail(mailReq *Mail) error
	NewMail(from string, to string, subject, body string, data *MailData) *Mail
}

Interface for the mail service

Jump to

Keyboard shortcuts

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