Anybody knows how to do this? I got all the information of the email (body, subject, from , to, cc, bcc) and need to generate an .eml file out of it.
You can construct |
|||||||||
|
EML files are just plain text files. The headers are separated from the body by a blank line. Headers look like this:
For more info, the official spec is RFC 2822. It's actually not as hard to read as some RFCs. Edit: When I said "plain text" I should have thought for a second. I really meant plain ASCII - and not the 8-bit "extended ASCII" either - just up to character 127. If you want more than seven bits, you need some kind of encoding and things get complicated. |
|||
|
You can create eml files with the following code. It works fine with thunderbird and probably with other email clients:
|
||||
|
Looking at a typical EML file it looks like a raw dump of the text communication that went to the server. So it is a text file containing the mail headers and body. To get your attachments, different views, etc in the correct format inside the EML file you need to MIME-encode the body and its parts. |
|||
|