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-04-17 UTC."],[[["\u003cp\u003eThis library, version 2.0.0-rc2, provides the functionality to send email messages from an App Engine application.\u003c/p\u003e\n"],["\u003cp\u003eThe package offers two primary functions: \u003ccode\u003eSend\u003c/code\u003e, for sending emails to specified recipients, and \u003ccode\u003eSendToAdmins\u003c/code\u003e, for sending emails directly to application administrators.\u003c/p\u003e\n"],["\u003cp\u003eEmail messages can be customized with attributes such as sender, recipients (To, Cc, Bcc), subject, body (text and HTML), and file attachments, all within the \u003ccode\u003eMessage\u003c/code\u003e struct.\u003c/p\u003e\n"],["\u003cp\u003eThe library includes an \u003ccode\u003eAttachment\u003c/code\u003e type to handle email attachments, requiring a valid file name and data, and allowing for a content ID.\u003c/p\u003e\n"],["\u003cp\u003eThis specific library version is in a Pre-GA stage, implying possible limited support and potential changes that might not be compatible across versions.\u003c/p\u003e\n"]]],[],null,[]]