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."],[[["The `mail` package enables App Engine applications to send emails, using functions like `Send` for general recipients and `SendToAdmins` for sending messages specifically to application administrators."],["The `Message` type represents an email with fields for sender, recipients (To, Cc, Bcc), subject, body (both plain text and HTML), attachments, and custom headers."],["Email attachments are supported through the `Attachment` type, which includes fields for name, data, and content ID, allowing for file attachments to be sent with the email."],["When creating a `Message`, you must specify a `Sender` who is either an application admin or the currently signed-in user, and ensure at least one recipient slice (To, Cc, Bcc) is filled, except when using the `SendToAdmins` function."]]],[]]