Automatically detect attachment mime type if it's NULL.

Closes #4. (BC break)