common

package
v0.0.0-...-38d8c38 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package common contains functions, structures, constants to be used across m-mail.

Index

Constants

This section is empty.

Variables

View Source
var (
	BEncoding = MimeEncoder{mime.BEncoding}
	QEncoding = MimeEncoder{mime.QEncoding}

	LastIndexByte = strings.LastIndexByte
	NewQPWriter   = quotedprintable.NewWriter

	SmtpNewClient = func(conn net.Conn, host string) (*smtp.Client, error) {
		return smtp.NewClient(conn, host)
	}
)

Functions

func AddStrToUniqueList

func AddStrToUniqueList(addrArray []string, addr string) []string

Add an address to an address array

func FormatDate

func FormatDate(date time.Time) string

FormatDate formats a date as a valid RFC 5322 date.

func HasSpecials

func HasSpecials(text string) bool

Checks whether string has special characters

func HostPortAddr

func HostPortAddr(host string, port int) string

Return formated address for host and port

func ParseAddress

func ParseAddress(addr string) (string, error)

Check for a valid email address

func SearchString

func SearchString(strArray []string, value string) bool

Check whether a string is present in string array

Types

type Encoding

type Encoding string

Encoding represents a MIME encoding scheme like quoted-printable or base64.

const (
	// QuotedPrintable represents the quoted-printable encoding as defined in
	// RFC 2045.
	QuotedPrintable Encoding = "quoted-printable"
	// Base64 represents the base64 encoding as defined in RFC 2045.
	Base64 Encoding = "base64"
	// Unencoded can be used to avoid encoding the body of an email. The headers
	// will still be encoded using quoted-printable encoding.
	Unencoded Encoding = "8bit"
)

type File

type File struct {
	Name     string
	Header   Header
	CopyFunc func(w io.Writer) error
}
type Header map[string][]string

message header

type MimeEncoder

type MimeEncoder struct {
	mime.WordEncoder
}

type Part

type Part struct {
	ContentType string
	Copier      func(io.Writer) error
	Encoding    string
}

Jump to

Keyboard shortcuts

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