aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/compose.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/compose.go b/app/compose.go
index fdc993ed..101a5765 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -5,6 +5,7 @@ import (
"bytes"
"fmt"
"io"
+ "math/rand"
"net/textproto"
"os"
"os/exec"
@@ -921,6 +922,10 @@ func getMessageIdHostname(c *Composer) (string, error) {
if err != nil {
return "", err
}
+ if len(addrs) == 0 {
+ // no from address present, generate a random hostname
+ return strings.ToUpper(strconv.FormatInt(rand.Int63(), 36)), nil
+ }
_, domain, found := strings.Cut(addrs[0].Address, "@")
if !found {
return "", fmt.Errorf("Invalid address %q", addrs[0])