emailer

package
v0.0.0-...-bf2171b Latest Latest
Warning

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

Go to latest
Published: May 31, 2015 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MAIL_SERVER = "localhost"
	MAIL_PORT   = 25

	LINE_MAX_LEN = 500 // for splitting encoded attachment data

	// templates for generating the message components
	ADDRESS    = "\"{{.DisplayName}}\" <{{.Address}}>"
	HEADERS    = "" /* 156-byte string literal not displayed */
	BODY       = "\r\n--{{.Boundary}}\r\nContent-Type: {{.ContentType}}\r\n\r\n{{.MessageBody}}"
	ATTACHMENT = "" /* 208-byte string literal not displayed */

	// message body mime types
	TEXT_MIME = "text/plain"
	HTML_MIME = "text/html"
)

Variables

This section is empty.

Functions

func GenerateAddress

func GenerateAddress(context *EmailAddress) (string, error)

func GenerateAttachment

func GenerateAttachment(attachment *EmailAttachment) (string, error)

func GenerateBody

func GenerateBody(message, contentType, boundary string) (string, error)

func GenerateBoundary

func GenerateBoundary() string

GenerateBoundary produces a random string that can be used for the email multipart boundary marker

func GenerateHeaders

func GenerateHeaders(sender, recipient, subject, boundary string) (string, error)

func Send

func Send(subject, message, messageType string, sender, recipient *EmailAddress, attachments []*EmailAttachment) error

Send transmits the given message, with optional attachments, via the default mail server (localhost) and port (25)

func SendFromServer

func SendFromServer(subject, message, messageType, server string, sender, recipient *EmailAddress, attachments []*EmailAttachment, port int) error

SendFromServer transmits the given message, with optional attachments, via the defined mail server and port

Types

type EmailAddress

type EmailAddress struct {
	DisplayName string
	Address     string
}

type EmailAttachment

type EmailAttachment struct {
	ContentType     string
	FileLocation    string
	FileName        string
	EncodedFileData string
	Boundary        string
}

type EmailBody

type EmailBody struct {
	ContentType string
	MessageBody string
	Boundary    string
}

type EmailHeaders

type EmailHeaders struct {
	Sender    string
	Recipient string
	Subject   string
	Boundary  string
}

Jump to

Keyboard shortcuts

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