Paquete google.golang.org/appengine/mail (v1.6.8)

El paquete mail proporciona los medios para enviar correos electrónicos desde una aplicación de App Engine.

Ejemplo:

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)
}

Funciones

func Send

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

Send envía un mensaje de correo electrónico.

func SendToAdmins

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

SendToAdmins envía un mensaje de correo electrónico a los administradores de la aplicación.

Adjunto

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

Un objeto Attachment representa un archivo adjunto a un correo electrónico.

Mensaje

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/standard/go/mail/
	// for permissible headers.
	Headers mail.Header
}

Un objeto Message representa un mensaje de correo electrónico. Las direcciones pueden tener cualquier formato que se permita en RFC 822.