How to read a MIME file? [email tut]

DON'T post new tutorials here! Please use the "Pending Submissions" board so the staff can review them first.
Post Reply
User avatar
isapiens
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 533
Joined: 05 May 2006, 16:00
17
Location: Turn around

How to read a MIME file? [email tut]

Post by isapiens »

I have a txt file. When i open it, its says in the header

Code: Select all

This is a multipart message in MIME format.

--HW.C56EA85700016299046F6F90
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The body of the text is just gibberish...
How am i supposed to read this?

I googled around and it said it is a type of an email, but its just a text file. Do i have to use Outlook Express or smth like that to read it?

Btw, is MIME no used because of security issues?
Fluoridation is the most monstrously conceived and dangerous communist plot we have ever had to face.

User avatar
DNR
Digital Mercenary
Digital Mercenary
Posts: 6114
Joined: 24 Feb 2006, 17:00
18
Location: Michigan USA
Contact:

MIME decoding

Post by DNR »

MIME explains how to decode the email, you do want to check out the RFCs both 822 and 2822 for study, http://www.faqs.org/rfcs/rfc2822.html
MIME, Multipupose Internet Mail Extensions, lets you send multiple pieces of different data in one message (say, a picture and a Word document), and it tells the recipient's email client what format the data is in so they can make smart choices displaying the message
Your email is in ASCII with rules, try decoding the Gibberish using a ASCII chart or BASE64 chart?
the ASCII characters making up the field-body, as
defined in the following sections, and consisting
of combinations of atom, quoted-string, and
specials tokens, or else consisting of texts
There are complex methods to decode the email manually, by taking it apart. You should be able to find tools, in various coding languages that can do this for you. Just search for MIME decode.



First download the contents of the email message.

Step 1
Check the "Content-Type" header. If the content type is multipart (i.e. "multipart/mixed", "multipart/alternative", etc) the message will have multiple sections to parse. If the content type is multipart, continue with below steps.

Step 2 The Content-Type header should contain a unique string used by the code that generated the MIME message to designate MIME part boundaries. Example: Content-Type: multipart/mixed; boundary="part_c7161025_fe8a_45f4_83ef_6befcfa5d021" The boundary string in this case is "part_c7161025_fe8a_45f4_83ef_6befcfa5d021".

Step 3 Each MIME part will be separated by the boundary string preceeded by two dashes ("--") on a blank line. You will need to scan the message line by line looking for the part boundaries. All text in between the boundaries *except the final CR/LF* is part of that MIME part. Important: The last MIME part will end with the boundary string followed by two more dashes. Example: --part_c7161025_fe8a_45f4_83ef_6befcfa5d021 First MIME part. --part_c7161025_fe8a_45f4_83ef_6befcfa5d021 Second MIME part --part_c7161025_fe8a_45f4_83ef_6befcfa5d021 Last MIME part. --part_c7161025_fe8a_45f4_83ef_6befcfa5d021--

Step 4 Each MIME part then needs to be parsed. The format of each MIME part is similar to the original RFC/822 formatted message. It will contain a series of headers, followed by a blank line, then the body data.

Step 5 A MIME part can itself be multipart, with its own "Content-Type" header and boundary string. Your code must recursively parse MIME parts until it reaches the child nodes.

Step 6 A MIME part can simply be a binary attachment. In this case a Filename header will usually be supplied, along with the transfer encoding. BASE64 is a popular encoding type. In this case the entire MIME part body must be BASE64 decoded. As an example here are the first few lines of an attached JPG image: ------_=_NextPart_003_01C755EF.43F2628D Content-Type: image/jpeg; name="testimage.jpg" Content-Transfer-Encoding: base64 Content-Description: testimage.jpg Content-Disposition: attachment; filename="testimage.jpg" /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAQABQQDASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA

Step 7 The HTML body of the message should be in a MIME section with ContentType: Text/Html, inside a ContentType: Multipart/Alternative MIME section.

Step 8 The plaintext body of the message should be in a MIME section with ContentType: Text/plain, inside a ContentType: Multipart/Alternative MIME section.

Have fun! :wink:

DNR
-
He gives wisdom to the wise and knowledge to the discerning. He reveals deep and hidden things; he knows what lies in Darkness, and Light dwells with him.

User avatar
isapiens
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 533
Joined: 05 May 2006, 16:00
17
Location: Turn around

Post by isapiens »

wow first of all i did not know you could encode an mp3 song into a mime text file. That's incredible. EDIT: you can encode other stuff too!!! like pdfs. nice.

I just typed MIME decoder in google and downloaded the first free program.

Thanks for the extensive reply DNR. I will definitely read upon this. Its cool.
Fluoridation is the most monstrously conceived and dangerous communist plot we have ever had to face.

User avatar
DNR
Digital Mercenary
Digital Mercenary
Posts: 6114
Joined: 24 Feb 2006, 17:00
18
Location: Michigan USA
Contact:

Post by DNR »

Here is some more stuff on Email, the problem most people would have with hacking email content is they don't actually 'download' the email to their pc to be able to handle it - to take it apart. The email they see is opened and displayed on a email host server, it is downloaded and executed on the server and not your pc. This makes email more AOL-like and noob-proof, and the email server has to deal with the bombs and virus scans so its not a bad idea.

If you want to take control over your emails you would setup a pop account, where the email server uploads the actual complete email file to you, and your pc is responsible for decoding it. You will also take the risk of virus and malware attack because you are opening the actual file.

The design of POP3 and its procedures allow users to retrieve e-mail from the POP host and then logoff. The desktop application would then decode and open the email for the user.

users have the option to leave mail on the server, e-mail users using POP3 generally connect, retrieve all messages, store them on the user's PC , delete them from the server, and then disconnect.

The newer Internet Message Access Protocol (IMAP) supports both connected (online) and disconnected (offline) modes of operation. E-mail clients using IMAP generally leave messages on the server until the user explicitly deletes them.

MIME serves as the standard for attachments and non-ASCII text in e-mail. Although neither POP3 nor SMTP require MIME-formatted e-mail, essentially all Internet e-mail comes MIME-formatted, so POP clients must also understand and use MIME. IMAP, by design, assumes MIME-formatted e-mail.

Mapping messages into and out of MIME format is typically done automatically by an e-mail client or by mail servers when sending or receiving Internet (SMTP/MIME) e-mail.

The IANA manages a registry of media types and character encodings. The organization makes a list available to the public through the Web.

http://www.iana.org/assignments/media-types/

The more you know, the more you need to know :wink:

DNR

--

http://en.wikipedia.org/wiki/Internet_media_type
http://en.wikipedia.org/wiki/MIME
-
He gives wisdom to the wise and knowledge to the discerning. He reveals deep and hidden things; he knows what lies in Darkness, and Light dwells with him.

Post Reply