mailer

package
v0.0.0-...-d9c52e5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

sender.go

sender_api.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIEmailSender

type APIEmailSender struct {
	// contains filtered or unexported fields
}

func NewAPIEmailSender

func NewAPIEmailSender(baseURL, apiKey, fromEmail, fromName string) *APIEmailSender

NewAPIEmailSender creates a new APIEmailSender instance

func (*APIEmailSender) SendEmail

func (sender *APIEmailSender) SendEmail(subject, text string, to []string, cc []string, bcc []string, attachFiles []string) error

SendEmail sends an email via API

type Attachment

type Attachment struct {
	Content     string `json:"content"`
	Filename    string `json:"filename"`
	Type        string `json:"type"`
	Disposition string `json:"disposition"`
	ContentID   string `json:"content_id"`
}

type EmailAddress

type EmailAddress struct {
	Email string `json:"email"`
	Name  string `json:"name,omitempty"`
}

type EmailSender

type EmailSender interface {
	SendEmail(
		subject string,
		content string,
		to []string,
		cc []string,
		bcc []string,
		attachFiles []string,
	) error
}

EmailSender interface to send emails

type MailPayload

type MailPayload struct {
	From        EmailAddress   `json:"from"`
	To          []EmailAddress `json:"to"`
	Cc          []EmailAddress `json:"cc,omitempty"`
	Bcc         []EmailAddress `json:"bcc,omitempty"`
	Subject     string         `json:"subject"`
	Text        string         `json:"text"`
	Category    string         `json:"category"`
	Attachments []Attachment   `json:"attachments,omitempty"`
}

type SMTPSender

type SMTPSender struct {
	// contains filtered or unexported fields
}

SMTPSender struct for SMTP email sending

func NewSMTPSender

func NewSMTPSender(name string, address string, host string, port string, username string, password string) *SMTPSender

NewSMTPSender creates a new SMTPSender instance

func (*SMTPSender) SendEmail

func (sender *SMTPSender) SendEmail(
	subject string,
	content string,
	to []string,
	cc []string,
	bcc []string,
	attachFiles []string,
) error

SendEmail sends an email via SMTP

Jump to

Keyboard shortcuts

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