@@ -3,15 +3,15 @@ package mailer
3
3
import (
4
4
"bytes"
5
5
"crypto/tls"
6
- "errors"
7
6
"fmt"
8
- "github.com/semaphoreui/semaphore/pkg/tz"
9
- "github.com/semaphoreui/semaphore/util"
10
7
"net"
11
8
"net/smtp"
12
9
"strings"
13
10
"text/template"
14
11
"time"
12
+
13
+ "github.com/semaphoreui/semaphore/pkg/tz"
14
+ "github.com/semaphoreui/semaphore/util"
15
15
)
16
16
17
17
const (
@@ -25,14 +25,12 @@ const (
25
25
"{{ .Body }}"
26
26
)
27
27
28
- var (
29
- r = strings .NewReplacer (
30
- "\r \n " , "" ,
31
- "\r " , "" ,
32
- "\n " , "" ,
33
- "%0a" , "" ,
34
- "%0d" , "" ,
35
- )
28
+ var r = strings .NewReplacer (
29
+ "\r \n " , "" ,
30
+ "\r " , "" ,
31
+ "\n " , "" ,
32
+ "%0a" , "" ,
33
+ "%0d" , "" ,
36
34
)
37
35
38
36
func parseTlsVersion (version string ) (uint16 , error ) {
@@ -65,7 +63,6 @@ func Send(
65
63
) error {
66
64
body := bytes .NewBufferString ("" )
67
65
tpl , err := template .New ("" ).Parse (mailerBase )
68
-
69
66
if err != nil {
70
67
return err
71
68
}
@@ -83,7 +80,6 @@ func Send(
83
80
Subject : r .Replace (subject ),
84
81
Body : content ,
85
82
})
86
-
87
83
if err != nil {
88
84
return err
89
85
}
@@ -131,7 +127,7 @@ func plainauth(
131
127
body * bytes.Buffer ,
132
128
) error {
133
129
auth := PlainOrLoginAuth (username , password , host )
134
- //auth := smtp.PlainAuth("", username, password, host)
130
+ // auth := smtp.PlainAuth("", username, password, host)
135
131
136
132
return smtp .SendMail (
137
133
net .JoinHostPort (host , port ),
@@ -220,7 +216,6 @@ func anonymous(
220
216
body * bytes.Buffer ,
221
217
) error {
222
218
c , err := smtp .Dial (net .JoinHostPort (host , port ))
223
-
224
219
if err != nil {
225
220
return err
226
221
}
@@ -236,7 +231,6 @@ func anonymous(
236
231
}
237
232
238
233
w , err := c .Data ()
239
-
240
234
if err != nil {
241
235
return err
242
236
}
0 commit comments