Compare commits
2 commits
279500db50
...
694c4ff93c
Author | SHA1 | Date | |
---|---|---|---|
694c4ff93c | |||
dc71cfdef4 |
2 changed files with 6 additions and 4 deletions
2
mail.go
2
mail.go
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
mail "gopkg.in/mail.v2"
|
mail "gopkg.in/mail.v2"
|
||||||
)
|
)
|
||||||
|
@ -33,6 +34,7 @@ func deliverMessage(s *ServerConfig, m *mail.Message) error {
|
||||||
if s.Encryption {
|
if s.Encryption {
|
||||||
dialer.StartTLSPolicy = mail.MandatoryStartTLS
|
dialer.StartTLSPolicy = mail.MandatoryStartTLS
|
||||||
}
|
}
|
||||||
|
dialer.Timeout = 30 * time.Second
|
||||||
return dialer.DialAndSend(m)
|
return dialer.DialAndSend(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
main.go
8
main.go
|
@ -18,7 +18,7 @@ func readFromConsole() string {
|
||||||
for counter < 3 {
|
for counter < 3 {
|
||||||
line, err = reader.ReadString('\n')
|
line, err = reader.ReadString('\n')
|
||||||
if line == "\n" {
|
if line == "\n" {
|
||||||
counter += 1
|
counter++
|
||||||
} else {
|
} else {
|
||||||
counter = 0
|
counter = 0
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ func main() {
|
||||||
var err error
|
var err error
|
||||||
var configPath, section, serverAddress, user, password, to, cc, bcc, from, subject, text string
|
var configPath, section, serverAddress, user, password, to, cc, bcc, from, subject, text string
|
||||||
var encryption, dbg, versionFlag bool
|
var encryption, dbg, versionFlag bool
|
||||||
var serverPort_ int
|
var serverPortAux int
|
||||||
var serverPort int64
|
var serverPort int64
|
||||||
|
|
||||||
flag.BoolVar(&versionFlag, "version", false, "Prints the version and exits")
|
flag.BoolVar(&versionFlag, "version", false, "Prints the version and exits")
|
||||||
|
@ -76,7 +76,7 @@ func main() {
|
||||||
flag.StringVar(§ion, "section", "default", "Section of the conf to read (defaults to \"default\")")
|
flag.StringVar(§ion, "section", "default", "Section of the conf to read (defaults to \"default\")")
|
||||||
flag.BoolVar(&dbg, "dbg", false, "Enable debugging output")
|
flag.BoolVar(&dbg, "dbg", false, "Enable debugging output")
|
||||||
flag.StringVar(&serverAddress, "server-address", "", "The SMTP server address")
|
flag.StringVar(&serverAddress, "server-address", "", "The SMTP server address")
|
||||||
flag.IntVar(&serverPort_, "server-port", 0, "The SMTP server")
|
flag.IntVar(&serverPortAux, "server-port", 0, "The SMTP server")
|
||||||
flag.BoolVar(&encryption, "force-ssl", false, "Force the use of ssl (defalut: false)")
|
flag.BoolVar(&encryption, "force-ssl", false, "Force the use of ssl (defalut: false)")
|
||||||
flag.StringVar(&user, "user", "", "The user to authenticate with to the server")
|
flag.StringVar(&user, "user", "", "The user to authenticate with to the server")
|
||||||
flag.StringVar(&password, "password", "", "The password to authenticate with to the server")
|
flag.StringVar(&password, "password", "", "The password to authenticate with to the server")
|
||||||
|
@ -102,7 +102,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
serverPort = int64(serverPort_)
|
serverPort = int64(serverPortAux)
|
||||||
Debug.F(
|
Debug.F(
|
||||||
`
|
`
|
||||||
---
|
---
|
||||||
|
|
Loading…
Reference in a new issue