mirror of
https://github.com/wneessen/go-mail.git
synced 2024-12-23 02:50:39 +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)
|
||||
}
|
||||
var addresses []string
|
||||
addresses = append(addresses, m.genHeader[HeaderDispositionNotificationTo]...)
|
||||
addresses = append(addresses, address.String())
|
||||
if _, ok := m.genHeader[HeaderDispositionNotificationTo]; ok {
|
||||
m.genHeader[HeaderDispositionNotificationTo] = addresses
|
||||
if current, ok := m.genHeader[HeaderDispositionNotificationTo]; ok {
|
||||
addresses = current
|
||||
}
|
||||
addresses = append(addresses, address.String())
|
||||
m.genHeader[HeaderDispositionNotificationTo] = addresses
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue