Add the beginnings of SMTP session management
This commit is contained in:
32
internal/smtp/session.go
Normal file
32
internal/smtp/session.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package smtp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
)
|
||||
|
||||
// type Session implements the User interface for emersion/go-smtp
|
||||
type Session struct {
|
||||
ID uint64
|
||||
AccountName string
|
||||
ServiceName string
|
||||
}
|
||||
|
||||
func (s *Session) Send(from string, to []string, r io.Reader) error {
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("%s session %d for %s: from=%s, to=%s, r=<<EOF\n%s\nEOF", s.ServiceName, s.ID, s.AccountName, from, to, string(data))
|
||||
|
||||
return fmt.Errorf("Not yet implemented")
|
||||
}
|
||||
|
||||
func (s *Session) Logout() error {
|
||||
log.Printf("Ending %s session %d for %s", s.ServiceName, s.ID, s.AccountName)
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user