Browse Source

Merge pull request #6 from barnjamin/master

checking for headers before trying to set on them
Jordan Wright 11 năm trước cách đây
mục cha
commit
8b6af705cd
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      email.go

+ 4 - 0
email.go

@@ -89,6 +89,10 @@ func (e *Email) Bytes() ([]byte, error) {
 	w := multipart.NewWriter(buff)
 	// Set the appropriate headers (overwriting any conflicts)
 	// Leave out Bcc (only included in envelope headers)
+	if e.Headers == nil {
+		e.Headers = textproto.MIMEHeader{}
+	}
+
 	e.Headers.Set("To", strings.Join(e.To, ","))
 	if e.Cc != nil {
 		e.Headers.Set("Cc", strings.Join(e.Cc, ","))