Add an extra check to make sure the MIME part has a Content-Type header

Fixes AttributeError: 'NoneType' object has no attribute 'strip'
Remove boring debug log
Minor cleanup