Skip to content

Commit a5a8e30

Browse files
committed
Add ErrAuthFailed
Convenience definition for backends. Defined in https://www.rfc-editor.org/rfc/rfc4954#section-6
1 parent 7bfb069 commit a5a8e30

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type Session struct{}
107107

108108
func (s *Session) AuthPlain(username, password string) error {
109109
if username != "username" || password != "password" {
110-
return errors.New("Invalid username or password")
110+
return smtp.ErrAuthFailed
111111
}
112112
return nil
113113
}

backend.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import (
55
)
66

77
var (
8+
ErrAuthFailed = &SMTPError{
9+
Code: 535,
10+
EnhancedCode: EnhancedCode{5, 7, 8},
11+
Message: "Authentication failed",
12+
}
813
ErrAuthRequired = &SMTPError{
914
Code: 502,
1015
EnhancedCode: EnhancedCode{5, 7, 0},

0 commit comments

Comments
 (0)