detect.go
func detectAttachmentHeader(header textproto.MIMEHeader) bool {
	mediatype, params, _, _ := parseMediaType(header.Get(hnContentDisposition))
	if strings.ToLower(mediatype) == cdAttachment ||
		(strings.ToLower(mediatype) == cdInline && len(params) > 0) {
		return true
	}

	mediatype, _, _, _ = parseMediaType(header.Get(hnContentType))
	return strings.ToLower(mediatype) == cdAttachment
}
func detectAttachmentHeader(header textproto.MIMEHeader) bool {
	mediatype, params, _, _ := parseMediaType(header.Get(hnContentDisposition))
	if strings.ToLower(mediatype) == cdAttachment ||
		(strings.ToLower(mediatype) == cdInline && len(params) > 0) {
		return true
	}

	mediatype, _, _, _ = parseMediaType(header.Get(hnContentType))
	return strings.ToLower(mediatype) == cdAttachment
}
// detectAttachmentHeader returns true, if the given header defines an attachment.  First it checks
// if the Content-Disposition header defines an attachement or inline attachment. If this test is
// false, the Content-Type header is checked for attachment, but not inline.  Email clients use
// inline for their text bodies.
//
// Valid Attachment-Headers:
//
//  - Content-Disposition: attachment; filename="frog.jpg"
//  - Content-Disposition: inline; filename="frog.jpg"
//  - Content-Type: attachment; filename="frog.jpg"