这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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