diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-01-06 18:35:36 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-01-06 18:35:36 +0100 |
| commit | 19c05fffcb1860b2dcf17989b40ca16ed259fdea (patch) | |
| tree | 12692bbb7c072cbd2aa8080b7a17edf155c64aeb | |
| parent | 07703435fa60e47c5730c5dd243534d8669b3152 (diff) | |
dashboard/app: receive and log email bounces
| -rw-r--r-- | dashboard/app/app.yaml | 3 | ||||
| -rw-r--r-- | dashboard/app/reporting_email.go | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/dashboard/app/app.yaml b/dashboard/app/app.yaml index 7b7715de6..13885ef37 100644 --- a/dashboard/app/app.yaml +++ b/dashboard/app/app.yaml @@ -5,6 +5,7 @@ api_version: go1 inbound_services: - mail +- mail_bounce handlers: - url: /favicon.ico @@ -25,6 +26,6 @@ handlers: script: _go_app login: admin secure: always -- url: /_ah/mail/.+ +- url: /_ah/(mail/.+|bounce) script: _go_app login: admin diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index 62cef1f2e..fddd14298 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -7,6 +7,7 @@ import ( "bytes" "encoding/json" "fmt" + "io/ioutil" "net/http" "net/mail" "strings" @@ -25,6 +26,7 @@ import ( func init() { http.HandleFunc("/email_poll", handleEmailPoll) http.HandleFunc("/_ah/mail/", handleIncomingMail) + http.HandleFunc("/_ah/bounce", handleEmailBounce) mailingLists = make(map[string]bool) for _, cfg := range config.Namespaces { @@ -333,6 +335,17 @@ func incomingMail(c context.Context, r *http.Request) error { return nil } +func handleEmailBounce(w http.ResponseWriter, r *http.Request) { + c := appengine.NewContext(r) + log.Errorf(c, "email bounced") + body, err := ioutil.ReadAll(r.Body) + if err != nil { + log.Errorf(c, "failed to read body: %v", err) + return + } + log.Infof(c, "%s", body) +} + func loadBugInfo(c context.Context, msg *email.Email) (bug *Bug, bugReporting *BugReporting, reporting *Reporting) { if msg.BugID == "" { if msg.Command == "" { |
