]> source.dussan.org Git - gitea.git/commitdiff
minor fix on #1517
authorUnknwon <u@gogs.io>
Thu, 20 Aug 2015 11:12:55 +0000 (19:12 +0800)
committerUnknwon <u@gogs.io>
Thu, 20 Aug 2015 11:12:55 +0000 (19:12 +0800)
modules/mailer/mailer.go

index 4fbacf291248a3cd7c1c4bec354f2954eea5be88..ce3ffc270ee3486922e941dfec3238bddccdcaac 100644 (file)
@@ -12,16 +12,16 @@ import (
        "net/smtp"
        "os"
        "strings"
-       "errors"
+
        "github.com/gogits/gogs/modules/log"
        "github.com/gogits/gogs/modules/setting"
 )
 
 type loginAuth struct {
-  username, password string
+       username, password string
 }
 
-//SMTP AUTH LOGIN Auth Handler
+// SMTP AUTH LOGIN Auth Handler
 func LoginAuth(username, password string) smtp.Auth {
        return &loginAuth{username, password}
 }
@@ -38,7 +38,7 @@ func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
                case "Password:":
                        return []byte(a.password), nil
                default:
-                       return nil, errors.New("Unkown fromServer")
+                       return nil, fmt.Errorf("unknwon fromServer: %s", string(fromServer))
                }
        }
        return nil, nil
@@ -162,8 +162,8 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
                        auth = smtp.CRAMMD5Auth(settings.User, settings.Passwd)
                } else if strings.Contains(options, "PLAIN") {
                        auth = smtp.PlainAuth("", settings.User, settings.Passwd, host)
-               //Patch for AUTH LOGIN
                } else if strings.Contains(options, "LOGIN") {
+                       // Patch for AUTH LOGIN
                        auth = LoginAuth(settings.User, settings.Passwd)
                }