forked from drew/smtprelay
feat: Add support for ignoring certs
This commit is contained in:
@@ -36,6 +36,7 @@ var (
|
||||
allowedUsers = flag.String("allowed_users", "", "Path to file with valid users/passwords")
|
||||
command = flag.String("command", "", "Path to pipe command")
|
||||
remoteHost = flag.String("remote_host", "", "Outgoing SMTP server")
|
||||
remoteSkipVerify = flag.Bool("remote_skip_verify", false, "Ignore invalid remote certificates")
|
||||
remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server")
|
||||
remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server")
|
||||
remoteAuthStr = flag.String("remote_auth", "none", "Auth method on outgoing SMTP server (none, plain, login)")
|
||||
|
||||
10
smtp.go
10
smtp.go
@@ -337,7 +337,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
|
||||
}
|
||||
var c *Client
|
||||
if port == "465" || port == "smtps" {
|
||||
config := &tls.Config{ServerName: host}
|
||||
config := &tls.Config{
|
||||
ServerName: host,
|
||||
InsecureSkipVerify: *remoteSkipVerify,
|
||||
}
|
||||
conn, err := tls.Dial("tcp", addr, config)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -360,7 +363,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
|
||||
return err
|
||||
}
|
||||
if ok, _ := c.Extension("STARTTLS"); ok {
|
||||
config := &tls.Config{ServerName: c.serverName}
|
||||
config := &tls.Config{
|
||||
ServerName: c.serverName,
|
||||
InsecureSkipVerify: *remoteSkipVerify,
|
||||
}
|
||||
if testHookStartTLS != nil {
|
||||
testHookStartTLS(config)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@
|
||||
; Mailjet.com
|
||||
;remote_host = in-v3.mailjet.com:587
|
||||
|
||||
; Ignore remote host certificates
|
||||
;remote_skip_verify = false
|
||||
|
||||
; Authentication credentials on outgoing SMTP server
|
||||
;remote_user =
|
||||
;remote_pass =
|
||||
|
||||
Reference in New Issue
Block a user