Fixing function call for new go-smtp
1 files changed, 5 insertions(+), 9 deletions(-)

M smtp/smtp.go
M smtp/smtp.go +5 -9
@@ 52,6 52,11 @@ func (s *Service) Send(msg *carrier.Mess
 
 	if s.config.SMTPEncType == "tls" {
 		c, err = smtp.DialTLS(addr, nil)
+	} else if s.config.SMTPEncType == "starttls" {
+		if ok, _ := c.Extension("STARTTLS"); !ok {
+			panic(fmt.Errorf("smtp: server doesn't support STARTTLS"))
+		}
+		c, err = smtp.DialStartTLS(addr, nil)
 	} else {
 		c, err = smtp.Dial(addr)
 	}

          
@@ 64,15 69,6 @@ func (s *Service) Send(msg *carrier.Mess
 		return err
 	}
 
-	if s.config.SMTPEncType == "starttls" {
-		if ok, _ := c.Extension("STARTTLS"); !ok {
-			panic(fmt.Errorf("smtp: server doesn't support STARTTLS"))
-		}
-		if err = c.StartTLS(nil); err != nil {
-			return err
-		}
-	}
-
 	if s.config.SMTPAuth == "plain" {
 		auth := sasl.NewPlainClient("", s.config.SMTPUser, s.config.SMTPPass)
 		if ok, _ := c.Extension("AUTH"); !ok {