1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-08-13 20:04:49 +02:00

Merge branch 'release/v1.27.3'

This commit is contained in:
Ralph Slooten
2025-07-29 01:21:55 +12:00
2 changed files with 7 additions and 8 deletions

View File

@@ -2,6 +2,12 @@
Notable changes to Mailpit will be documented in this file. Notable changes to Mailpit will be documented in this file.
## [v1.27.3]
### Fix
- Fix sendmail when using an `--smtp-addr <ip>:<port>` ([#542](https://github.com/axllent/mailpit/issues/542))
## [v1.27.2] ## [v1.27.2]
### Feature ### Feature

View File

@@ -8,7 +8,6 @@ import (
"net" "net"
"net/mail" "net/mail"
"net/smtp" "net/smtp"
"net/url"
"os" "os"
"strings" "strings"
@@ -75,12 +74,6 @@ func Send(addr string, from string, to []string, msg []byte) error {
} }
func sendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) error { func sendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) error {
addrParsed, err := url.Parse(addr) // ensure addr is a valid URL
if err != nil {
return fmt.Errorf("invalid address: %s", addr)
}
host := addrParsed.Host
if err := validateLine(from); err != nil { if err := validateLine(from); err != nil {
return err return err
} }
@@ -102,7 +95,7 @@ func sendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
} }
if ok, _ := c.Extension("STARTTLS"); ok { if ok, _ := c.Extension("STARTTLS"); ok {
config := &tls.Config{ServerName: host, InsecureSkipVerify: true} // #nosec config := &tls.Config{ServerName: addr, InsecureSkipVerify: true} // #nosec
if err = c.StartTLS(config); err != nil { if err = c.StartTLS(config); err != nil {
return err return err
} }