作者 唐旭辉

优化

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