email

package
v0.0.0-...-269b0f3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupAddressesByHost

func GroupAddressesByHost(addrs []string) (map[string][]string, error)

Group a list of email addresses by their host. An error will be returned if any of the addresses are invalid.

Types

type Attachment

type Attachment struct {
	Filename    string `json:"filename"`
	ContentType string `json:"content_type"`
	Content     string `json:"content"`
	Encoded     bool   `json:"encoded"`
}

Email attachment. The content of the attachment is provided either as a UTF-8 string or as a Base64-encoded string ("encoded" set to "true").

func (Attachment) Write

func (a Attachment) Write(w *multipart.Writer) error

Write the attachment to the specified multipart writer.

type Email

type Email struct {
	From        string       `json:"from"`
	To          []string     `json:"to"`
	Cc          []string     `json:"cc"`
	Bcc         []string     `json:"bcc"`
	Subject     string       `json:"subject"`
	Headers     Headers      `json:"headers"`
	Text        string       `json:"text"`
	Html        string       `json:"html"`
	Attachments []Attachment `json:"attachments"`
}

Abstract representation of an email.

func (*Email) Messages

func (e *Email) Messages(s *queue.Storage) ([]*queue.Message, error)

Convert the email into an array of messages grouped by host suitable for delivery to the mail queue.

type Headers

type Headers map[string]string

Map of email headers.

func (Headers) Write

func (e Headers) Write(w io.Writer) error

Write the headers to the specified io.Writer. RFC 2047 provides details on how non-ASCII characters should be encoded.

type Raw

type Raw struct {
	From string   `json:"from"`
	To   []string `json:"to"`
	Body string   `json:"body"`
}

Raw represents a raw email message ready for delivery.

func (*Raw) DeliverToQueue

func (r *Raw) DeliverToQueue(q *queue.Queue) error

DeliverToQueue delivers raw messages to the queue.

Jump to

Keyboard shortcuts

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