diff --git a/message.go b/message.go index 9f7f7bd..0993737 100644 --- a/message.go +++ b/message.go @@ -105,14 +105,16 @@ func (m *Message) SetBoundary(boundary string) { // SetHeader sets a value to the given header field. func (m *Message) SetHeader(field string, value ...string) { - m.encodeHeader(value) - m.header[field] = value + m.header[field] = m.encodeHeader(value) } -func (m *Message) encodeHeader(values []string) { +func (m *Message) encodeHeader(values []string) []string { + encoded := make([]string, len(values)) for i := range values { - values[i] = m.encodeString(values[i]) + encoded[i] = m.encodeString(values[i]) } + + return encoded } func (m *Message) encodeString(value string) string {