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)
| 43 | // |
| 44 | // To export only the email part of mail.Address, you can set withName to false. |
| 45 | func 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 | // |
searching dependent graphs…