(fromServer []byte, more bool)
| 49 | } |
| 50 | |
| 51 | func (a *smtpAutoAuth) Next(fromServer []byte, more bool) ([]byte, error) { |
| 52 | if !more { |
| 53 | return nil, nil |
| 54 | } |
| 55 | |
| 56 | switch a.mech { |
| 57 | case "LOGIN": |
| 58 | switch string(fromServer) { |
| 59 | case "Username:": |
| 60 | return []byte(a.username), nil |
| 61 | case "Password:": |
| 62 | return []byte(a.password), nil |
| 63 | default: |
| 64 | return nil, errors.New("unknown SMTP AUTH LOGIN challenge") |
| 65 | } |
| 66 | case "NTLM": |
| 67 | return ntlmssp.NewAuthenticateMessage(fromServer, a.username, a.password, nil) |
| 68 | default: |
| 69 | return nil, errors.New("unexpected SMTP auth challenge") |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | func smtpServerSupportsAuth(server *smtp.ServerInfo, mechanism string) bool { |
| 74 | if server == nil { |
no outgoing calls