Abstract: Based on the e-mail boxes of documents Foxmail an analysis of this paper, a mail box mail will be automatically exported to separate. "Eml" mail format document, the export documents for e-mail software such as OutLook open. The method in dealing with large quantities of letterhead derived better results.
INTRODUCTION
Foxmail in China has already become the first choice of mail software, its features have also beyond Outlook, but Foxmail is not perfect, especially in the mail folder mail export, backup processing do is not very good, only one hand a closure letter will be derived, if the number of letters also less able to cope with such treatment, but if the hundreds of mail handling this is obviously still a very difficult decision. Therefore, this article by Foxmail mail folder and document analysis is a procedure automatically through a folder of all e-mail messages to a specific folder derived approach.
Foxmail mail folder composition analysis
In order to achieve the program's folder Foxmail email address, we must first Foxmail mail folders and internal e-mail and the composition of the storage format to have a clear understanding. Foxmail access to the installation directory, and then, a message to ourselves, after receiving the letter, read every document the installation directory attribute the time, found that only fmnmtk.dat document is the latest, but far smaller than the size of the document issued by the mail, and should therefore be excluded. Mail folder subdirectory counterparts Foxmail account. Enter account number corresponding to a particular folder, the folder in and out, and send documents such as trash, respectively Write folder, the folder items, have been sent folders and waste bins.
In a clear message folder corresponding to store files, they can see through the binary mail software to further analysis of the internal structure of folders. Under the circumstances it can be concluded within a folder of the e-mail messages are stored in the same paper, this paper mail folder on the mail volume can be derived from e-mail into a separate folder in the various documents and e-mail their output to the external documentation. Thus, in the internal documents of the mail folder structure of the analysis, the only concern the two border mail can be. Open a mail folder paper, we can see start of a 16-band says:
10 10 10 10 10 10 10 11 11 11 11 11 11 53 0D 0A
52 65 74 75 72 6E 2D 50 61 74 68 3A 20 3C 7A 68
Here, the start of a very structured code, it can make a guess for the first document format or the format of the various e-mail first, in the paper right before 7 10 and six 11 for a total of 13 characters in search, we find that there are many of the same characters , and the search to a few of the characters in neighbouring characters "53", "0 D" and "0 A" at the same time, the subsequent character is not fixed, it can be further assumed that 16 characters for the format of the first e-mail instead of the first document format (file format in the first usually only once at the beginning of the paper), then mail folder paper 16 characters in this search and search records to the number of e-mail can be found exactly the same number of e-mail folders in the match, and the deletion or e-mail added, the number will change accordingly. Based on the above situation can be concluded that "10 10 10 10 10 10 10 11 11 11 11 11 11 53 0D 0A" is the first e-mail format, according to the head can be separated from e-mail.
The Design and Implementation of procedures
Foxmail clear in the e-mail folder structure of the composition of the paper, the extraction of the internal e-mail, is not difficult to export, and programming is the central idea of the message format is the first discriminant, and subsequent e-mail data in the document is derived. To this end, all e-mail folders can search the contents of the documents ASCII code 10 (16 hex), once found that the character that was 15 bytes may be the first e-mail format, and then later to determine whether the 15-byte format to meet the first e-mail, once a byte that is not in line with its e-mail format is not the first and not being dealt with, or begun to export data into e-mail documents, closed at the same time on an opened the export documents:
/ / Read documents from mail folders characters
C = fgetc (fp1);
While (! Feof (fp1))
(
/ / Separation characteristics found the beginning of a string of characters, then enter the check () function for analysis
If (c == 0x10)
Check ();
/ / Output file name generation
J + +;
Filename.Format ( "% d", j);
/ / Export documents to be established on the storage path
Char exeFullPath [MAX_PATH];
CString strPath;
GetModuleFileName (NULL, exeFullPath, MAX_PATH);
StrPath = CString (exeFullPath);
StrPath = strPath.Left (strPath.ReverseFind ( '\ \'));
StrPath strPath + = "\ \ mail \ \" + CString (filename) +. "Eml";
Strcpy (fullname, strPath);
/ / Open the way to export the file to write, if file does not exist, create the
Fp2 = fopen (fullname, "w");
/ / Not at the end of the input file, but not the beginning of a string of separate features characters, characters will be written into the document output
While (! Feof (fp1) & & (c = fgetc (fp1))! = 0x10)
Fputc (c, fp2);
)
Among them, e-mail format for the first judgement is in check () function completed, x10 order to 0 after 15 bytes to judge, once found e-mail format is not the first character immediately return e-mail and its contents as data processing only conclude that the e-mail format will be the first after the closure of an export file:
For (int i = 0; i <6; i + +)
(
C = fgetc (fp1);
/ / String does not meet the characteristics of separation, the return
If (c! = 0x10)
Return;
)
For (i = 0; i <6; i + +)
(
C = fgetc (fp1);
/ / String with separate characteristics, it can be concluded that the return e-mail the contents of a folder
If (c! = 0x11)
Return;
)
If ((c = fgetc (fp1)) == 0x53)
If ((c = fgetc (fp1)) == 0x0D)
If ((c = fgetc (fp1)) == 0x0A)
(
C = fgetc (fp1);
/ / String fully consistent with features, the output end of the current e-mail, document output closure
Fclose (fp2);
)
Since this procedure is designed to automatically export volume mail processing data is generally relatively large, in order to avoid procedural obstruction, this process can be placed on a thread of. The experiment, derived from the above procedures for OutLook eml files can be opened and identification documents, to achieve the desired purpose.
Summary
Based on the composition of Foxmail mail folder structure analysis and the ultimate realization of its e-mail volume is derived, which provides great convenience to Foxmail email backup, and management work, but also different versions of Foxmail have good support (current the latest version is 4.2, this method applicable), e-mail may be a practical support management tool. This paper described in the code under Windows 2000 Professional from Microsoft Visual C + + 6.0 compiler through. |