Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: impl/prod/mail.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: tests and words Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/prod/context.go ('k') | service/mail/context.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/prod/mail.go
diff --git a/impl/prod/mail.go b/impl/prod/mail.go
new file mode 100644
index 0000000000000000000000000000000000000000..47d68a032fad90747d9c0a66ce664fa4adb4b6ac
--- /dev/null
+++ b/impl/prod/mail.go
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package prod
+
+import (
+ gae_mail "github.com/luci/gae/service/mail"
+ "golang.org/x/net/context"
+ "google.golang.org/appengine/mail"
+)
+
+// useMail adds a mail service implementation to context, accessible
+// by "github.com/luci/gae/service/mail".Get(c)
+func useMail(c context.Context) context.Context {
+ return gae_mail.SetFactory(c, func(ci context.Context) gae_mail.Interface {
+ return mailImpl{AEContext(ci)}
+ })
+}
+
+type mailImpl struct {
+ aeCtx context.Context
+}
+
+func (m mailImpl) Send(msg *gae_mail.Message) error {
+ return mail.Send(m.aeCtx, msg.ToSDKMessage())
+}
+
+func (m mailImpl) SendToAdmins(msg *gae_mail.Message) error {
+ return mail.Send(m.aeCtx, msg.ToSDKMessage())
+}
+
+func (m mailImpl) Testable() gae_mail.Testable {
+ return nil
+}
« no previous file with comments | « impl/prod/context.go ('k') | service/mail/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698