Attachment handling within VMail

Adding an attachment in a Compose Window

To identify a file type for an attachment that is being added to a compose window, VMail does the following :

  1. try to match the extension against ~/.mime.types, $VMAILHOME/etc/mime.types, /usr/local/etc/mime.types, and /etc/mime.types in that order.
  2. failing this, it then tries content based detection by using the file command, specifying $VMAILHOME/etc/magic as the magic file to use.
  3. failing this, it gives up and puts "unknown" as the file type.

Forwarding Messages with Attachments

Please note that messages that are sent to you in mime or sun format will keep whatever the sending email package has set the file type to. When you forward the note to someone else, it sends it with the same file type.

Viewing Attachments

When you view an attachment (either from a compose or the main window), it will first do any decoding required. If the existing file type was empty, unknown, application/octet-string, or application/octet-stream, then it will attempt to come up with a different file type (same rules as above).

Then it matches the file type against ~/.mailcap, $VMAILHOME/etc/mailcap, /usr/local/etc/mailcap, and /etc/mailcap (in that order) to get the command to execute. Note that the temporary file is placed in /tmp with the name userid.pid.filename.ext and the command should contain a "%s" that the filename is substituted into.

After the command line is built, it is executed in the background as a completely independant process. When the "viewer" exits, the temporary file is removed.


17 August 1995 - jvgulik@cse