lib

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

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

Go to latest
Published: Jul 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SmtpExpressURL string = "https://api.smtpexpress.com"

Functions

func MustParseURL

func MustParseURL(rawURL string) *url.URL

Types

type APIClient

type APIClient struct {
	Send *SendService
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(projectSecret string, cfg *Config) *APIClient

type Config

type Config struct {
	BaseUrl    *url.URL
	HttpClient *http.Client
}

type MailRecipient

type MailRecipient = MailSender

type MailSender

type MailSender struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type MailTemplate

type MailTemplate struct {
	ID        string            `json:"id,omitempty"`
	Variables map[string]string `json:"variables,omitempty"`
}

type SendMailOptions

type SendMailOptions struct {
	Subject    string          `json:"subject,omitempty"`
	Message    string          `json:"message,omitempty"`
	Sender     MailSender      `json:"sender,omitempty"`
	Recipients []MailRecipient `json:"recipients,omitempty"`
}

type SendMailResponse

type SendMailResponse struct {
	Message    string `json:"message"`
	StatusCode int    `json:"statusCode"`
	Data       struct {
		Ref string `json:"ref"`
	} `json:"data"`
}

type SendMailWithTemplateOptions

type SendMailWithTemplateOptions struct {
	Subject    string          `json:"subject,omitempty"`
	Template   MailTemplate    `json:"template,omitempty"`
	Sender     MailSender      `json:"sender,omitempty"`
	Recipients []MailRecipient `json:"recipients,omitempty"`
}

type SendService

type SendService service

func (*SendService) SendMail

func (s *SendService) SendMail(ctx context.Context, options SendMailOptions) (SendMailResponse, error)

func (*SendService) SendMailWithTemplate

func (s *SendService) SendMailWithTemplate(ctx context.Context, options SendMailWithTemplateOptions) (SendMailResponse, error)

Jump to

Keyboard shortcuts

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