Added a small performance tweak in getRecipients()
This commit is contained in:
parent
faa9a603a2
commit
42c5f98096
9
send.go
9
send.go
|
@ -73,7 +73,14 @@ func (m *Message) getFrom() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) getRecipients() ([]string, error) {
|
func (m *Message) getRecipients() ([]string, error) {
|
||||||
var list []string
|
n := 0
|
||||||
|
for _, field := range []string{"To", "Cc", "Bcc"} {
|
||||||
|
if addresses, ok := m.header[field]; ok {
|
||||||
|
n += len(addresses)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list := make([]string, 0, n)
|
||||||
|
|
||||||
for _, field := range []string{"To", "Cc", "Bcc"} {
|
for _, field := range []string{"To", "Cc", "Bcc"} {
|
||||||
if addresses, ok := m.header[field]; ok {
|
if addresses, ok := m.header[field]; ok {
|
||||||
for _, a := range addresses {
|
for _, a := range addresses {
|
||||||
|
|
Loading…
Reference in New Issue