mail

package
v0.20.0-alpha6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2016 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mail provides the means of sending email from an App Engine application.

Example:

msg := &mail.Message{
	Sender:  "romeo@montague.com",
	To:      []string{"Juliet <juliet@capulet.org>"},
	Subject: "See you tonight",
	Body:    "Don't forget our plans. Hark, 'til later.",
}
if err := mail.Send(c, msg); err != nil {
	log.Errorf(c, "Alas, my user, the email failed to sendeth: %v", err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(c context.Context, msg *Message) error

Send sends an email message.

func SendToAdmins

func SendToAdmins(c context.Context, msg *Message) error

SendToAdmins sends an email message to the application's administrators.

Types

type Attachment

type Attachment struct {
	// Name must be set to a valid file name.
	Name      string
	Data      []byte
	ContentID string
}

An Attachment represents an email attachment.

type Message

type Message struct {
	// Sender must be set, and must be either an application admin
	// or the currently signed-in user.
	Sender  string
	ReplyTo string // may be empty

	// At least one of these slices must have a non-zero length,
	// except when calling SendToAdmins.
	To, Cc, Bcc []string

	Subject string

	// At least one of Body or HTMLBody must be non-empty.
	Body     string
	HTMLBody string

	Attachments []Attachment

	// Extra mail headers.
	// See https://cloud.google.com/appengine/docs/go/mail/
	// for permissible headers.
	Headers mail.Header
}

A Message represents an email message. Addresses may be of any form permitted by RFC 822.

Jump to

Keyboard shortcuts

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