作者 唐旭辉

优化

@@ -42,9 +42,9 @@ func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) { @@ -42,9 +42,9 @@ func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
42 } 42 }
43 43
44 switch { 44 switch {
45 - case bytes.Equal(fromServer, []byte("username:")): 45 + case bytes.EqualFold(fromServer, []byte("Username:")):
46 return []byte(a.username), nil 46 return []byte(a.username), nil
47 - case bytes.Equal(fromServer, []byte("Password:")): 47 + case bytes.EqualFold(fromServer, []byte("Password:")):
48 return []byte(a.password), nil 48 return []byte(a.password), nil
49 default: 49 default:
50 return nil, fmt.Errorf("mail: unexpected server challenge: %s", fromServer) 50 return nil, fmt.Errorf("mail: unexpected server challenge: %s", fromServer)
@@ -3,7 +3,7 @@ package goemail @@ -3,7 +3,7 @@ package goemail
3 import "testing" 3 import "testing"
4 4
5 const ( 5 const (
6 - testTo1 = "554895468@qq.com" 6 + testTo1 = ""
7 testTo2 = "to2@example.com" 7 testTo2 = "to2@example.com"
8 testFrom = "" 8 testFrom = ""
9 testpwd = "" 9 testpwd = ""