'Return the message\'s content type.
The returned string is coerced to lower case of the form
`maintype/subtype\'.  If there was no Content-Type header in the
message, the default type as given by get_default_type() will be
returned.  Since according to RFC 2045, messages always have a default
type this will always return a value.
RFC 2045 defines a message\'s default type to be text/plain unless it
appears inside a multipart/digest container, in which case it would be
message/rfc822.'

def get_content_type(self):

    missing = object()
    value = self.get('content-type', missing)
    if (value is missing):
        return self.get_default_type()
    ctype = _splitparam(value)[0].lower()
    if (ctype.count('/') != 1):
        return 'text/plain'
    return ctype
