Skip to content

Commit

Permalink
Add ErrAuthFailed
Browse files Browse the repository at this point in the history
Convenience definition for backends.

Defined in https://www.rfc-editor.org/rfc/rfc4954#section-6
  • Loading branch information
emersion committed Jun 12, 2023
1 parent 7bfb069 commit a5a8e30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type Session struct{}

func (s *Session) AuthPlain(username, password string) error {
if username != "username" || password != "password" {
return errors.New("Invalid username or password")
return smtp.ErrAuthFailed
}
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import (
)

var (
ErrAuthFailed = &SMTPError{
Code: 535,
EnhancedCode: EnhancedCode{5, 7, 8},
Message: "Authentication failed",
}
ErrAuthRequired = &SMTPError{
Code: 502,
EnhancedCode: EnhancedCode{5, 7, 0},
Expand Down

0 comments on commit a5a8e30

Please sign in to comment.