func CreateSingleInlineWriter(w io.Writer, header Header) (io.WriteCloser, error) {
	header = header.Copy()  
	initInlineContentTransferEncoding(&header.Header)
	return message.CreateWriter(w, header.Header)
}
CreateSingleInlineWriter writes a mail header to w. The mail will contain a
single inline part. The body of the part should be written to the returned
io.WriteCloser. Only one single inline part should be written, use
CreateWriter if you want multiple parts.
package mail
import (
	"io"
	"strings"
	"github.com/emersion/go-message"
)
func initInlineContentTransferEncoding(h *message.Header) {
	if !h.Has("Content-Transfer-Encoding") {
		t, _, _ := h.ContentType()
		if strings.HasPrefix(t, "text/") {
			h.Set("Content-Transfer-Encoding", "quoted-printable")
		} else {
			h.Set("Content-Transfer-Encoding", "base64")
		}
	}
}
func initInlineHeader(h *InlineHeader) {
	h.Set("Content-Disposition", "inline")
	initInlineContentTransferEncoding(&h.Header)
}
func initAttachmentHeader(h *AttachmentHeader) {
	disp, _, _ := h.ContentDisposition()
	if disp != "attachment" {
		h.Set("Content-Disposition", "attachment")
	}
	if !h.Has("Content-Transfer-Encoding") {
		h.Set("Content-Transfer-Encoding", "base64")
	}
}
type Writer struct {
	mw *message.Writer
}
func CreateWriter(w io.Writer, header Header) (*Writer, error) {
	header = header.Copy()  
	header.Set("Content-Type", "multipart/mixed")
	mw, err := message.CreateWriter(w, header.Header)
	if err != nil {
		return nil, err
	}
	return &Writer{mw}, nil
}
func CreateInlineWriter(w io.Writer, header Header) (*InlineWriter, error) {
	header = header.Copy()  
	header.Set("Content-Type", "multipart/alternative")
	mw, err := message.CreateWriter(w, header.Header)
	if err != nil {
		return nil, err
	}
	return &InlineWriter{mw}, nil
}