Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions email.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func sendSMTPEmail(to, cc, bcc []string, from, subject, body string, attachments
}
}

// If no authentication is provided, disable it for internal mail relays
if server.Username == "" && server.Password == "" {
server.Authentication = mail.AuthNone
}

switch strings.ToLower(smtpEncryption) {
case "ssl":
server.Encryption = mail.EncryptionSSLTLS
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ var rootCmd = &cobra.Command{
if from == "" {
from = smtpUsername
}
case smtpHost != "":
// Allow SMTP delivery with just host for internal mail relays (no auth)
deliveryMethod = SMTP
}

switch deliveryMethod {
Expand Down