MCPcopy
hub / github.com/pocketbase/pocketbase / addressesToStrings

Function addressesToStrings

tools/mailer/mailer.go:45–58  ·  view source on GitHub ↗

addressesToStrings converts the provided address to a list of serialized RFC 5322 strings. To export only the email part of mail.Address, you can set withName to false.

(addresses []mail.Address, withName bool)

Source from the content-addressed store, hash-verified

43//
44// To export only the email part of mail.Address, you can set withName to false.
45func addressesToStrings(addresses []mail.Address, withName bool) []string {
46 result := make([]string, len(addresses))
47
48 for i, addr := range addresses {
49 if withName && addr.Name != "" {
50 result[i] = addr.String()
51 } else {
52 // keep only the email part to avoid wrapping in angle-brackets
53 result[i] = addr.Address
54 }
55 }
56
57 return result
58}
59
60// detectReaderMimeType reads the first couple bytes of the reader to detect its MIME type.
61//

Callers 3

sendMethod · 0.85
TestAddressesToStringsFunction · 0.85
sendMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by 1

TestAddressesToStringsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…