sort email output

This commit is contained in:
shoopea
2023-07-31 10:20:31 +02:00
parent b4d27e0867
commit 2afd699099
2 changed files with 10 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/base64"
"fmt"
"net/smtp"
"sort"
"strings"
"sync"
"time"
@@ -45,7 +46,11 @@ func (e *Email) Send() error {
return nil
}
body := " - " + e.items[0]
sort.Slice(e.items, func(i, j int) bool {
return e.items[i] < e.items[j]
})
body := e.items[0]
for _, item := range e.items[1:] {
body = body + "\r\n" + item
}