35 lines
704 B
Go
35 lines
704 B
Go
package smtp
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"io/ioutil"
|
|
"log"
|
|
|
|
"ur.gs/crockery/internal/store"
|
|
)
|
|
|
|
// type Session implements the User interface for emersion/go-smtp
|
|
type Session struct {
|
|
ID uint64
|
|
Account *store.Account
|
|
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.Account.Username, 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.Account.Username)
|
|
|
|
return nil
|
|
}
|