Documentation
¶
Index ¶
- type BodyType
- type GoogleMessage
- func (m *GoogleMessage) Attach(name string, data []byte, headers *textproto.MIMEHeader, inlineCID string) error
- func (m *GoogleMessage) GetAttachments() map[string]*GooglePart
- func (m *GoogleMessage) GetBody(bodyType BodyType) (*textproto.MIMEHeader, []byte)
- func (m *GoogleMessage) Has(name string) bool
- func (m *GoogleMessage) Send(client *http.Client) (string, error)
- func (m *GoogleMessage) SetBody(data []byte, headers *textproto.MIMEHeader, bodyType BodyType) error
- func (m *GoogleMessage) Token() (*oauth2.Token, error)
- func (m *GoogleMessage) WriteTo(w io.Writer) (int64, error)
- type GooglePart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleMessage ¶
type GoogleMessage struct { Header textproto.MIMEHeader // headers AccessToken string WriteHeadersSorted bool // contains filtered or unexported fields }
GoogleMessage describes an email message.
func (*GoogleMessage) Attach ¶
func (m *GoogleMessage) Attach(name string, data []byte, headers *textproto.MIMEHeader, inlineCID string) error
Attach attaches to the message an attachment as a file. Passing an empty content deletes the file with the same name if it was previously added.
func (*GoogleMessage) GetAttachments ¶ added in v0.0.9
func (m *GoogleMessage) GetAttachments() map[string]*GooglePart
GetAttachments - returns a list of non-body attachment parts
func (*GoogleMessage) GetBody ¶ added in v0.0.8
func (m *GoogleMessage) GetBody(bodyType BodyType) (*textproto.MIMEHeader, []byte)
GetBody returns a previously set body of type bodyType if no body for bodyType has been set, the an empty byte slice is returned
func (*GoogleMessage) Has ¶
func (m *GoogleMessage) Has(name string) bool
Has returns true if a file with that name was in the message as an attachment.
func (*GoogleMessage) Send ¶
func (m *GoogleMessage) Send(client *http.Client) (string, error)
Send sends the message through GMail. Pass in client to over-ride the http.Client used. Otherwise the default will be used Returns the Message-Id header for the sent email
func (*GoogleMessage) SetBody ¶
func (m *GoogleMessage) SetBody(data []byte, headers *textproto.MIMEHeader, bodyType BodyType) error
SetBody sets the contents of the text of the letter.
You can use text or HTML message format (is determined automatically). To guarantee that the format will be specified as HTML, consider wrapping the text with <html> tag. When adding the HTML content, text version, to support legacy mail program will be added automatically. When you try to add as message binary data will return an error. You can pass as a parameter the nil, then the message will be without a text submission. Use bodyType to specify which type of body is being set. Using Auto only allows one body part. To have both an html body and a text body, call twice, once for each kind
type GooglePart ¶ added in v0.0.9
type GooglePart struct { Header textproto.MIMEHeader // headers Data []byte // content }
GooglePart describes googlePart email message: the file or message.