Found a bug in Android API. In the following code,
if the file name has a space character, the result mime is null.
File f = some_file;
String mime = null;
MimeTypeMap mime_map = MimeTypeMap.getSingleton();
mime = mime_map.getMimeTypeFromExtension( MimeTypeMap.getFileExtensionFromUrl( f.getAbsolutePath() ) );
Also, there is another problem. Even though I pass the correct mime type along the file stream calling the Intent.ACTION_SEND activity, the resulting email has the file section without any "content-type" field!