Documentation
¶
Index ¶
- Variables
- func CreateQuotedPart(writer *multipart.Writer, contentType string) (w *quotedprintable.Writer, err error)
- func HandleEmailFromReader(r io.Reader, h partHandler) (err error)
- func NewMimeBase64Writer(w io.Writer) io.WriteCloser
- func ToASCII(s string) string
- type Alternative
- type File
- type Mixed
- type Part
- type Parts
- type Text
Constants ¶
This section is empty.
Variables ¶
var ( // Unformatted Text TextPlain = "text/plain; charset=utf-8" // HTML TextHTML = "text/html; charset=utf-8" // Markdown TextMarkdown = "text/markdown; charset=utf-8" // File attachments MultipartMixed = "multipart/mixed" // Text and HTML content MultipartAlternative = "multipart/alternative" )
Content Types
var ErrMaximumMultipartDepth = errors.New("Mimestream: Maximum multipart/mime nesting level reached")
var ErrMaximumPartsPerMultipart = errors.New("Mimestream: Maximum number of multipart/mime parts reached")
var ErrMissingBoundary = errors.New("Missing boundary")
ErrMissingBoundary for multipart bodies without a boundary header
var ErrPartialWrite = errors.New("Failed to write full body")
ErrPartialWrite happens when the full body can't be written
var MaximumMultipartDepth = 10
Most emails will never contain more than 3 levels of nested multipart bodies
var MaximumPartsPerMultipart = 50
Most emails will never have more than a dozen attachments / text parts total
Functions ¶
func CreateQuotedPart ¶
func CreateQuotedPart(writer *multipart.Writer, contentType string) (w *quotedprintable.Writer, err error)
CreateQuotedPart creates a quoted-printable, wrapped, mime part
func HandleEmailFromReader ¶
NewEmailFromReader reads a stream of bytes from an io.Reader, r, and returns an email struct containing the parsed data. This function expects the data in RFC 5322 format.
func NewMimeBase64Writer ¶
func NewMimeBase64Writer(w io.Writer) io.WriteCloser
NewMimeBase64Writer base64 encodes content and wraps to 76 characters
Types ¶
type File ¶
type File struct {
// Name is the basename name of the file
Name string
// Optional, will be detected by File.Name extension
ContentType string
// Include Inline, or as an Attachment (default)?
Inline bool
// Character set to use (defaults to utf-8)
Charset string
// Reader is the data source that the part is populated from.
io.Reader
// Closer is an optional io.Closer that is called after reading the Reader
io.Closer
}
File is a multipart implementation for files read from an io.Reader.
type Part ¶
type Part interface {
// Name can be a field name or content type. It is the part Content-Type
Add(w *multipart.Writer) error
}
Part defines a named part inside of a multipart message. Part is a data source that can add itself to a mime/multipart.Writer.