| // Copyright 2017 The Go Authors. All rights reserved. |
| // Use of this source code is governed by the Apache 2.0 |
| // license that can be found in the LICENSE file. |
| // The pubsubhelper is an SMTP server for Gerrit updates and an HTTP |
| // server for Github webhook updates. It then lets other clients subscribe |
| "github.com/bradfitz/go-smtpd/smtpd" |
| func (e *env) AddRecipient(rcpt smtpd.MailAddress) error { |
| return e.BasicEnvelope.AddRecipient(rcpt) |
| func (e *env) Write(line []byte) error { |
| if e.body.Len() > maxSize { |
| func (e *env) Close() error { |
| log.Printf("Got email: %s\n", e.body.Bytes()) |
| func onNewMail(c smtpd.Connection, from smtpd.MailAddress) (smtpd.Envelope, error) { |
| log.Printf("new MAIL FROM %q", from) |
| BasicEnvelope: new(smtpd.BasicEnvelope), |
| log.Printf("running pubsubhelper on port 25") |
| err := s.ListenAndServe() |
| log.Fatalf("ListenAndServe: %v", err) |