gmapi

package module
v0.0.0-...-74657fe Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 7 Imported by: 0

README

gmapi

Craft emails in RFC2822 format with MIME for the Gmail API

Supports non-ascii header values

Gmail API Guide

RFC 2822 Internet Message Format

RFC 2045 Multipurpose Internet Mail Extensions (MIME)

RFC 2047 Message Header Extensions for Non-ASCII Text

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename string
	Data     []byte
	Inline   bool
	// CID (Content-ID) allows referencing in the body of email, eg <img src="cid:[cid]" />
	CID string
}

Attachment represents a file Data is expected to be in binary and will be base64 standard encoded automatically

type Message

type Message struct {
	From        string
	To          string
	CC          string
	BCC         string
	Subject     string
	Headers     textproto.MIMEHeader
	Body        string
	Attachments []Attachment
}

Message represents an email to be sent commonly used fields From, To, CC, BCC and Subject are provided for convenience and overwrite their corresponding entry in Headers for maximum customization access Headers directly

func NewMessage

func NewMessage() *Message

func (*Message) Raw

func (m *Message) Raw() string

Raw converts message to base64url encoded rfc2822 format with MIME

func (*Message) RawUnencoded

func (m *Message) RawUnencoded() string

Raw converts message to unencoded rfc2822 format with MIME

func (*Message) ToGmailMessage

func (m *Message) ToGmailMessage() *gmail.Message

ToGmailMessage is a convenience function that returns a ready to send gmail Message with Raw property set and label ids set to 'UNREAD' and 'INBOX'

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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