Skip to content

Commit

Permalink
Make go vet happy with server example (#28)
Browse files Browse the repository at this point in the history
* added missing import of "io" in server example

* make go vet happy by adding comments for exported methods

* don't assign name to imported module
  • Loading branch information
Lutz Horn authored and emersion committed Jan 23, 2019
1 parent 9ea8004 commit 14578f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,26 @@ import (
"github.com/emersion/go-smtp"
)

// The Backend implements SMTP server methods.
type Backend struct{}

// Login handles a login command with username and password.
func (bkd *Backend) Login(username, password string) (smtp.User, error) {
if username != "username" || password != "password" {
return nil, errors.New("Invalid username or password")
}
return &User{}, nil
}

// Require clients to authenticate using SMTP AUTH before sending emails
// AnonymousLogin requires clients to authenticate using SMTP AUTH before sending emails
func (bkd *Backend) AnonymousLogin() (smtp.User, error) {
return nil, smtp.ErrAuthRequired
}

// A User is returned after successful login.
type User struct{}

// Send handles an email.
func (u *User) Send(from string, to []string, r io.Reader) error {
log.Println("Sending message:", from, to)

Expand All @@ -91,6 +95,7 @@ func (u *User) Send(from string, to []string, r io.Reader) error {
return nil
}

// Logout handles logout.
func (u *User) Logout() error {
return nil
}
Expand Down

0 comments on commit 14578f1

Please sign in to comment.