func (w *InlineWriter) Close() error {
	return w.mw.Close()
}
Close finishes the InlineWriter.
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
}
func CreateSingleInlineWriter(w io.Writer, header Header) (io.WriteCloser, error) {
	header = header.Copy()  
	initInlineContentTransferEncoding(&header.Header)
	return message.CreateWriter(w, header.Header)
}
func (w *Writer) CreateInline() (*InlineWriter, error) {
	var h message.Header
	h.Set("Content-Type", "multipart/alternative")
	mw, err := w.mw.CreatePart(h)
	if err != nil {
		return nil, err
	}
	return &InlineWriter{mw}, nil
}
func (w *Writer) CreateSingleInline(h InlineHeader) (io.WriteCloser, error) {
	h = InlineHeader{h.Header.Copy()}  
	initInlineHeader(&h)
	return w.mw.CreatePart(h.Header)
}
func (w *Writer) CreateAttachment(h AttachmentHeader) (io.WriteCloser, error) {
	h = AttachmentHeader{h.Header.Copy()}  
	initAttachmentHeader(&h)
	return w.mw.CreatePart(h.Header)
}
func (w *Writer) Close() error {
	return w.mw.Close()
}
type InlineWriter struct {
	mw *message.Writer
}
func (w *InlineWriter) CreatePart(h InlineHeader) (io.WriteCloser, error) {
	h = InlineHeader{h.Header.Copy()}  
	initInlineHeader(&h)
	return w.mw.CreatePart(h.Header)
}