mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-15 02:12:55 +01:00
Refactor RequestMDNAddTo
Simplify the address handling for the "Disposition-Notification-To" header in msg.go. The code now directly reassigns the previously fetched addresses and ensures appending the new address effectively. This improves code readability and correctness in updating the header.
This commit is contained in:
parent
4f97cd8261
commit
4fe9022815
1 changed files with 4 additions and 4 deletions
8
msg.go
8
msg.go
|
@ -1237,11 +1237,11 @@ func (m *Msg) RequestMDNAddTo(rcpt string) error {
|
||||||
return fmt.Errorf(errParseMailAddr, rcpt, err)
|
return fmt.Errorf(errParseMailAddr, rcpt, err)
|
||||||
}
|
}
|
||||||
var addresses []string
|
var addresses []string
|
||||||
addresses = append(addresses, m.genHeader[HeaderDispositionNotificationTo]...)
|
if current, ok := m.genHeader[HeaderDispositionNotificationTo]; ok {
|
||||||
addresses = append(addresses, address.String())
|
addresses = current
|
||||||
if _, ok := m.genHeader[HeaderDispositionNotificationTo]; ok {
|
|
||||||
m.genHeader[HeaderDispositionNotificationTo] = addresses
|
|
||||||
}
|
}
|
||||||
|
addresses = append(addresses, address.String())
|
||||||
|
m.genHeader[HeaderDispositionNotificationTo] = addresses
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue