From f7bd69218d9ab82a5f6507c6990777e91bbc195c Mon Sep 17 00:00:00 2001 From: Felix Rothballer Date: Tue, 5 Aug 2025 22:17:23 +0200 Subject: [PATCH] fixes charmbracelet/pop#136 --- email.go | 5 +++++ main.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/email.go b/email.go index 3b4efb2..9512704 100644 --- a/email.go +++ b/email.go @@ -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 diff --git a/main.go b/main.go index a820b78..d744882 100644 --- a/main.go +++ b/main.go @@ -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 {