Simplified some code
This commit is contained in:
parent
5a1ac3fca0
commit
07a1f385b7
|
@ -200,7 +200,7 @@ func (m *Message) DelHeader(field string) {
|
|||
// SetBody sets the body of the message.
|
||||
func (m *Message) SetBody(contentType, body string) {
|
||||
m.parts = []part{
|
||||
part{
|
||||
{
|
||||
contentType: contentType,
|
||||
copier: func(w io.Writer) error {
|
||||
_, err := io.WriteString(w, body)
|
||||
|
@ -243,7 +243,7 @@ func (m *Message) AddAlternative(contentType, body string) {
|
|||
// })
|
||||
func (m *Message) AddAlternativeWriter(contentType string, f func(io.Writer) error) {
|
||||
m.parts = []part{
|
||||
part{
|
||||
{
|
||||
contentType: contentType,
|
||||
copier: f,
|
||||
},
|
||||
|
|
|
@ -40,8 +40,8 @@ func (w *messageWriter) writeMessage(m *Message) {
|
|||
for _, part := range m.parts {
|
||||
contentType := part.contentType + "; charset=" + m.charset
|
||||
w.writeHeaders(map[string][]string{
|
||||
"Content-Type": []string{contentType},
|
||||
"Content-Transfer-Encoding": []string{string(m.encoding)},
|
||||
"Content-Type": {contentType},
|
||||
"Content-Transfer-Encoding": {string(m.encoding)},
|
||||
})
|
||||
w.writeBody(part.copier, m.encoding)
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ func (w *messageWriter) openMultipart(mimeType string) {
|
|||
w.writeString("\r\n")
|
||||
} else {
|
||||
w.createPart(map[string][]string{
|
||||
"Content-Type": []string{contentType},
|
||||
"Content-Type": {contentType},
|
||||
})
|
||||
}
|
||||
w.depth++
|
||||
|
|
Loading…
Reference in New Issue