func detectTextHeader(header textproto.MIMEHeader, emptyContentTypeIsText bool) bool {
	ctype := header.Get(hnContentType)
	if ctype == "" && emptyContentTypeIsText {
		return true
	}

	mediatype, _, _, err := parseMediaType(ctype)
	if err != nil {
		return false
	}
	switch mediatype {
	case ctTextPlain, ctTextHTML:
		return true
	}

	return false
}
func detectTextHeader(header textproto.MIMEHeader, emptyContentTypeIsText bool) bool {
	ctype := header.Get(hnContentType)
	if ctype == "" && emptyContentTypeIsText {
		return true
	}

	mediatype, _, _, err := parseMediaType(ctype)
	if err != nil {
		return false
	}
	switch mediatype {
	case ctTextPlain, ctTextHTML:
		return true
	}

	return false
}
// detectTextHeader returns true, if the the MIME headers define a valid 'text/plain' or 'text/html'
// part.  If the emptyContentTypeIsPlain argument is set to true, a missing Content-Type header will
// result in a positive plain part detection.