detect.go
func detectBinaryBody(root *Part) bool {
	if detectTextHeader(root.Header, true) {
		return false
	}

	isBin := detectAttachmentHeader(root.Header)
	if !isBin {
		// This must be an attachment, if the Content-Type is not
		// 'text/plain' or 'text/html'.
		// Example:
		// Content-Type: application/pdf; name="doc.pdf"
		mediatype, _, _, _ := parseMediaType(root.Header.Get(hnContentType))
		mediatype = strings.ToLower(mediatype)
		if mediatype != ctTextPlain && mediatype != ctTextHTML {
			return true
		}
	}

	return isBin
}
func detectBinaryBody(root *Part) bool {
	if detectTextHeader(root.Header, true) {
		return false
	}

	isBin := detectAttachmentHeader(root.Header)
	if !isBin {
		// This must be an attachment, if the Content-Type is not
		// 'text/plain' or 'text/html'.
		// Example:
		// Content-Type: application/pdf; name="doc.pdf"
		mediatype, _, _, _ := parseMediaType(root.Header.Get(hnContentType))
		mediatype = strings.ToLower(mediatype)
		if mediatype != ctTextPlain && mediatype != ctTextHTML {
			return true
		}
	}

	return isBin
}
// detectBinaryBody returns true if the mail header defines a binary body.