mail

package module
v0.0.0-...-096c5a5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EncryptionTLS sets encryption type to TLS when sending email
	EncryptionTLS encryption = iota
	// EncryptionSSL sets encryption type to SSL when sending email
	EncryptionSSL
	// EncryptionNone uses no encryption when sending email
	EncryptionNone
)
View Source
const (
	// EncodingQuotedPrintable sets the message body encoding to quoted-printable
	EncodingQuotedPrintable encoding = iota
	// EncodingBase64 sets the message body encoding to base64
	EncodingBase64
	// EncodingNone turns off encoding on the message body
	EncodingNone
)
View Source
const (
	// PriorityHigh sets the email priority to High
	PriorityHigh priority = iota
	// PriorityLow sets the email priority to Low
	PriorityLow
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	Charset        string
	Encoding       encoding
	Encryption     encryption
	Username       string
	Password       string
	TLSConfig      *tls.Config
	ConnectTimeout int
	Error          error
	// contains filtered or unexported fields
}

Email represents an email message.

func New

func New() *Email

New creates a new email. It uses UTF-8 by default.

func (*Email) AddAddresses

func (email *Email) AddAddresses(header string, addresses ...string) *Email

AddAddresses allows you to add addresses to the specified address header.

func (*Email) AddAlternative

func (email *Email) AddAlternative(contentType, body string) *Email

AddAlternative allows you to add alternative parts to the body of the email message. This is most commonly used to add an html version in addition to a plain text version that was already added with SetBody.

func (*Email) AddAttachment

func (email *Email) AddAttachment(file string, name ...string) *Email

AddAttachment allows you to add an attachment to the email message. You can optionally provide a different name for the file.

func (*Email) AddAttachmentWithMIME

func (email *Email) AddAttachmentWithMIME(f io.Reader, mime string, name ...string) *Email

func (*Email) AddBcc

func (email *Email) AddBcc(addresses ...string) *Email

AddBcc adds a Bcc address. You can provide multiple addresses at the same time.

func (*Email) AddCc

func (email *Email) AddCc(addresses ...string) *Email

AddCc adds a Cc address. You can provide multiple addresses at the same time.

func (*Email) AddHeader

func (email *Email) AddHeader(header string, values ...string) *Email

AddHeader adds the given "header" with the passed "value".

func (*Email) AddHeaders

func (email *Email) AddHeaders(headers textproto.MIMEHeader) *Email

AddHeaders is used to add mulitple headers at once

func (*Email) AddInline

func (email *Email) AddInline(file string, name ...string) *Email

AddInline allows you to add an inline attachment to the email message. You can optionally provide a different name for the file.

func (*Email) AddTo

func (email *Email) AddTo(addresses ...string) *Email

AddTo adds a To address. You can provide multiple addresses at the same time.

func (*Email) GetError

func (email *Email) GetError() error

GetError returns the first email error encountered

func (*Email) GetMessage

func (email *Email) GetMessage() string

GetMessage builds and returns the email message

func (*Email) Send

func (email *Email) Send(address string) error

Send sends the composed email

func (*Email) SetBody

func (email *Email) SetBody(contentType, body string) *Email

SetBody sets the body of the email message.

func (*Email) SetDate

func (email *Email) SetDate(dateTime string) *Email

SetDate sets the date header to the provided date/time. The format of the string should be YYYY-MM-DD HH:MM:SS Time Zone.

Example: SetDate("2015-04-28 10:32:00 CDT")

func (*Email) SetFrom

func (email *Email) SetFrom(address string) *Email

SetFrom sets the From address.

func (*Email) SetPriority

func (email *Email) SetPriority(priority priority) *Email

SetPriority sets the email message priority. Use with either "High" or "Low".

func (*Email) SetReplyTo

func (email *Email) SetReplyTo(address string) *Email

SetReplyTo sets the Reply-To address.

func (*Email) SetReturnPath

func (email *Email) SetReturnPath(address string) *Email

SetReturnPath sets the Return-Path address. This is most often used to send bounced emails to a different email address.

func (*Email) SetSender

func (email *Email) SetSender(address string) *Email

SetSender sets the Sender address.

func (*Email) SetSubject

func (email *Email) SetSubject(subject string) *Email

SetSubject sets the subject of the email message.

Jump to

Keyboard shortcuts

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