Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



The mail package

import "appengine/mail"

Introduction

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

Example:

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

Index

func Send(c appengine.Context, msg *Message) error
func SendToAdmins(c appengine.Context, msg *Message) error
type Attachment
type Message

func Send

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

Send sends an email message.

func SendToAdmins

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

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

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://developers.google.com/appengine/docs/go/mail/overview
    // for permissible headers.
    Headers mail.Header
}

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

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.