Mulberry uses a MIME type to file extension mapping scheme to determine what MIME to use for outgoing attachments, and determine which file extension should be used for incoming attachments. Mulberry looks for mapping files in the following locations (if they exist):
If more than one file exists, Mulberry reads in the entries in each file determined by the order above, and duplicate entries are replaced. Thus an entry in /etc/mime.types will be overridden by an equivalent entry in ~/.mime.types allowing users to override site defaults with their own settings, if required.
The mapping file has the following format for each line, which represents a single entry, and can include as many entries as needed:
<mime_type> <tab> <comma separated list of extensions>
image/jpeg jpg jpeg
For outgoing attachments, Mulberry looks to see if the attached file has a file extension. If it does, Mulberry looks up the extension in the mime mappings databse. If a mapping is found, that MIME type/subtype is assigned to the attachment. If no extension exists in the file name, or there is no mapping for the extension, Mulberry defaults to using application/octet-stream for the attachment.
For incoming attachments, Mulberry will try and remap or add a file extension to the incoming attachment name using the following rules. If an entry for the MIME type/subtype exists in the MIME database, Mulberry looks to see whether the extension on the incoming attachment matches any of those associated with the MIME type/subtype. If there is a match, the incoming attachment name is not changed. If there is no match, Mulberry will change the incoming attachment name to have the first extension listed for that MIME type/subtype. If the incoming MIME type/subtype is application/octet-stream, this remapping does not occur.