attachments

package
v0.0.0-...-41ef739 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64Buffer

type Base64Buffer struct {
	*bytes.Buffer
}

Represents a buffer that holds base64 encoded information.

type EmbeddedBinaryObject

type EmbeddedBinaryObject struct {
	// Filename is the name of the attachment or image.
	Filename string
	// Data is the base64 encoded data for this attachment or image.
	Data Base64Buffer
	// MimeType stores the MIME type detected for this file based upon it's filename extension.
	MIMEType mime.Type
}

EmbeddedBinaryObject contains the data necessary to attach a file or embed an image into an email.

func FileAttachmentFromFile

func FileAttachmentFromFile(filePath string) (*EmbeddedBinaryObject, error)

FileAttachmentFromFile will return a EmbeddedBinaryObject based upon the file path provided.

func FileAttachmentFromReader

func FileAttachmentFromReader(filename string, reader io.Reader) (*EmbeddedBinaryObject, error)

FileAttachmentFromReader will return a EmbeddedBinaryObject based upon the data provided and provided filename. Filename is the name of the file to be attached, not the path to a file.

func InlineImageFromFile

func InlineImageFromFile(imageName string, imagePath string) (*EmbeddedBinaryObject, error)

InlineImageFromFile will return an EmbeddedBinaryObject based upon the file path provided. The imageName is the value used in the <img src=” /> tags in the corresponding HTML body. It is recommended this is the actual file's name so that the MIME type can be properly detected.

func InlineImageFromPath

func InlineImageFromPath(imagePath string) (*EmbeddedBinaryObject, error)

InlineImageFromPath will return an EmbeddedBinaryObject based upon the file path provided. The name of the image will be inferred from it's filename.

func InlineImageFromReader

func InlineImageFromReader(imageName string, reader io.Reader) (*EmbeddedBinaryObject, error)

InlineImageFromReader will return an EmbeddedBinaryObject based upon the data provided. The imageName is the value used in the <img src=” /> tags in the corresponding HTML body. It is recommended this is the actual file's name so that the MIME type can be properly detected.

func NewEmbeddedBinaryObject

func NewEmbeddedBinaryObject() *EmbeddedBinaryObject

Jump to

Keyboard shortcuts

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