Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions email.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/mail"
"net/textproto"
"strconv"
"strings"
"time"

"github.com/toorop/go-dkim"
Expand Down Expand Up @@ -786,6 +787,13 @@ func (server *SMTPServer) Connect() (*SMTPClient, error) {
tlsConfig = &tls.Config{ServerName: server.Host}
}

if server.Helo == "" {
atIndex := strings.LastIndex(server.Username, "@")
if atIndex >= 0 {
server.Helo = server.Username[atIndex+1:]
}
}

// if there is a ConnectTimeout, setup the channel and do the connect under a goroutine
if server.ConnectTimeout != 0 {
smtpConnectChannel = make(chan error, 2)
Expand Down