Go 1.11 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Go 1.11
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Go
1.11 applications will continue to run and receive traffic after their
deprecation date. We
recommend that you migrate to the latest supported version of Go.
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-08-04 UTC."],[[["Package mail facilitates sending emails from within an App Engine application, enabling communication directly from the application."],["The `Send` function is used to send email messages to specified recipients, allowing for customized content and addressing."],["The `SendToAdmins` function is specifically designed to send email messages directly to the application's administrators."],["The `Message` type allows users to construct complex emails, including setting the sender, multiple recipients, subject, plain or HTML body, attachments, and extra headers."],["Email attachments can be added through the `Attachment` type, which requires a valid file name, the file's data, and an optional ContentID."]]],[]]