1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

storage: Store addresses as mail.Address for #69

This commit is contained in:
James Hillyerd
2018-03-11 16:56:09 -07:00
parent 487e491d6f
commit 3bc66d2788
9 changed files with 49 additions and 33 deletions

View File

@@ -5,6 +5,7 @@ import (
"crypto/sha1"
"fmt"
"io"
"net/mail"
"strings"
)
@@ -224,3 +225,14 @@ LOOP:
return buf.String(), domain, nil
}
// StringAddressList converts a list of addresses to a list of strings
func StringAddressList(addrs []*mail.Address) []string {
s := make([]string, len(addrs))
for i, a := range addrs {
if a != nil {
s[i] = a.String()
}
}
return s
}