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.",}iferr:=mail.Send(c,msg);err!=nil{log.Errorf(c,"Alas, my user, the email failed to sendeth: %v",err)}
SendToAdmins sends an email message to the application's administrators.
Attachment
typeAttachmentstruct{// Name must be set to a valid file name.NamestringData[]byteContentIDstring}
An Attachment represents an email attachment.
Message
typeMessagestruct{// Sender must be set, and must be either an application admin// or the currently signed-in user.SenderstringReplyTostring// may be empty// At least one of these slices must have a non-zero length,// except when calling SendToAdmins.To,Cc,Bcc[]stringSubjectstring// At least one of Body or HTMLBody must be non-empty.BodystringHTMLBodystringAttachments[]Attachment// Extra mail headers.// See https://cloud.google.com/appengine/docs/standard/go/mail/// for permissible headers.Headersmail.Header}
A Message represents an email message.
Addresses may be of any form permitted by RFC 822.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-05 UTC."],[[["This documentation covers version 2.0.5 of the `mail` package for Go App Engine applications, which provides functionality for sending email."],["The `mail.Send` function allows applications to send emails to specified recipients, and the `mail.SendToAdmins` function enables sending emails directly to application administrators."],["Email messages are represented by the `mail.Message` struct, which includes fields for sender, recipients, subject, body (plain text and HTML), and attachments."],["Email attachments are handled through the `mail.Attachment` struct, which requires a name, data, and an optional content ID."],["The `mail` package documentation and its older versions are accessible via pkg.go.dev for more detailed information."]]],[]]