Documentation ¶
Index ¶
- func AddFilters(c context.Context, filts ...Filter) context.Context
- func Send(c context.Context, msg *Message) error
- func SendToAdmins(c context.Context, msg *Message) error
- func Set(c context.Context, u RawInterface) context.Context
- func SetFactory(c context.Context, f Factory) context.Context
- type Attachment
- type Factory
- type Filter
- type Message
- type RawInterface
- type TestMessage
- type Testable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFilters ¶
AddFilters adds RawInterface filters to the context.
func SendToAdmins ¶
SendToAdmins sends an e-mail message to application administrators.
Types ¶
type Attachment ¶
type Attachment struct { // Name must be set to a valid file name. Name string Data []byte ContentID string }
Attachment is a mimic of https://godoc.org/google.golang.org/appengine/mail#Attachment
It's provided here for convenience, and is compile-time checked to be identical.
type Factory ¶
type Factory func(context.Context) RawInterface
Factory is the function signature for factory methods compatible with SetFactory.
type Filter ¶
type Filter func(context.Context, RawInterface) RawInterface
Filter is the function signature for a filter mail implementation. It gets the current mail implementation, and returns a new mail implementation backed by the one passed in.
type Message ¶
type Message struct { Sender string ReplyTo string To, Cc, Bcc []string Subject string Body string HTMLBody string Attachments []Attachment Headers net_mail.Header }
Message is a mimic of https://godoc.org/google.golang.org/appengine/mail#Message
It's provided here for convenience, and is init-time checked to be identical (not statically because []Attachement prevents static casting).
func (*Message) ToSDKMessage ¶
ToSDKMessage returns a copy of this Message that's compatible with the native SDK's Message type. It only needs to be used by implementations (like "impl/prod") which need an SDK compatible object
type RawInterface ¶
type RawInterface interface { Send(msg *Message) error SendToAdmins(msg *Message) error GetTestable() Testable }
RawInterface is the interface for all of the mail methods.
These replicate the methods found here: https://godoc.org/google.golang.org/appengine/mail
func Raw ¶
func Raw(c context.Context) RawInterface
Raw pulls the raw mail service implementation from context or nil if it wasn't set.
type TestMessage ¶
type TestMessage struct { Message // MIMETypes is guaranteed to be the same length as the attachments in the // Message, and will be populated with the derived MIME types for the // attachments. MIMETypes []string }
TestMessage is the message struct which will be returned from SentMessages.
It augments the Message struct by also including the derived MIMEType for any attachments.
func (*TestMessage) Copy ¶
func (t *TestMessage) Copy() *TestMessage
Copy duplicates this TestMessage.
type Testable ¶
type Testable interface { // Sets the list of admin emails. By default, testing implementations should // use ["admin@example.com"]. SetAdminEmails(emails ...string) // SentMessages returns a copy of all messages which were successfully sent // via the mail API. SentMessages() []*TestMessage // Reset clears the SentMessages queue. Reset() }
Testable is the interface for mail service implementations which are able to be tested (like impl/memory).
func GetTestable ¶
GetTestable returns a testable extension interface, or nil if one is not available.