-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.go
29 lines (25 loc) · 665 Bytes
/
utilities.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package postmark
import (
"net/mail"
"strings"
)
// Address will return a from/to compatible string of the given contact
func Address(name, email string) string {
address := mail.Address{
Name: name,
Address: email,
}
return address.String()
}
// Addresses will join a list of addresses to a comma separated list
func Addresses(addresses ...mail.Address) string {
list := []string{}
for _, address := range addresses {
list = append(list, address.String())
}
return strings.Join(list, ", ")
}
// Emails will join a list of email addresses into a comma separated list
func Emails(emails ...string) string {
return strings.Join(emails, ", ")
}