Email parsing engine Fastmail library big success!

xiaoxiao2021-03-06  73

1 Overview

The mail parsing API fully uses object-oriented technology design, using C language, developed for mail resolution and assembly. It provides some classes to resolve and assemble Internet mail, such as MimeMessage and MimeBodypart for Internet mail protocol implementation and follow RFC822 and RFC2045 specifications. These API libraries are used for applications.

1.1 term

RFC: Request for Comments, request annotation, Internet standards (draft)

Mime: Multipurpose Internet Mail Extension Protocol, multi-purpose internet mail expansion protocol

2 mail resolution library

2.1 implementation process

This mail parser (Fastmail) refers to the structure of JavaMail, with similar interfaces and classes. This resolution library uses the base library FAST library reference ACE library and STL, Java Framework library design, including some string processing and containers. Designing their purpose is to simplify the interface of the library and try to compat with the interface of the Java library, while using a fully standard C feature, making the library more easily more stable.

These two libraries have been developed from 2004 to June.

2004-10-10

Completed, last more than 3 months, because it is not fully investment, the actual time consuming is about 2 months, because there is a JavaMail, ACE and STL library, it is more smooth. The code amount of two libraries has about 32,000 lines of code. The class design is reasonable and provides a rich interface for secondary development and transformation.

Below is a list of file lists of two libraries and classes of the mail resolution library (the Fast Library is specifically introduced):

2.2 File list

FAST base library

Comm./

Comm ./faStarray.h array class

Comm ./fastautoptr.h automatic management pointer class

Comm ./fastbase.h Fast library public definition, containing a complete memory allocator class

Comm ./fasthashmap.h HashMap container class

Comm ./fastmap.h Map container class

Comm ./faststring.h faststring string processing class

Comm ./fastvector.h vector container class

Mail parsing engine fastmail library

MIME /

MIME / CHARSETUTILS.CPP string encoding and decoding tools

MIME / CHARSETUTILS.H

MIME / MIMEACTIVATION.CPP Mail Analytical Initialization Tool

MIME / MIMEACTIVATION.H

MIME / MIMEBASE.H mail resolution public definition

MIME / MIMECONTAINER.CPP mail parsing Multipart container

MIME / MIMECONTAINER.H

MIME / MIMEENTITY.CPP mail parsing MIME entity class

Mime / mimeTiTY.H

MIME / MIMEMESSAGE.CPP mail parsing MIME mail class

MIME / MIMEMESSAGE.H

MIME / MIMEOBJECT.CPP mail parsing MIME object class

MIME / MIMEOBJECT.H

MIME / MIMEPARSER.CPP Mail Resolution Tool Class

MIME / MIMEPARSER.H

MIME / MIMEUTILITY.CPP mail resolution tool class

MIME / MIMEUTILITY.H

3 Implementation of class 3.1 class 3.1

The mail resolution library contains a series of classes, mainly MimeMessage, MIMEBODYPART, MIMEMULTIPART, InternetHeaders, InternetDress, InternetDress, InternetDress, InternetDress, InternetdRess (mail address class) And ContentType, etc. Analysis and assembly emails mainly use these classes to assemble and decompose.

Here's a description of all classes:

Class name

name

Description

Base class

ContentDisPosition Mime Mailhead Realizing the ContentDisPosition of MIME Mail Head

ContentID MIME Email Head to implement the ContentID of MIME Mailhead

ContentType Mime Mailhead Realizing the ContentType of MIME Mailhead

MIMETYPE MIME Type Class implementation MIME type, recorded in ContentType, such as Text / Plain

ConverterFactory Code Conversion Factory Class is used to create encoded conversion objects

ICODECONVERTER encoding conversion interface class

Base64Converter Base64 encoding class base64 encoding and decoding icodeconverter QPConverter QP encoding class Quote-Printable encoding and decoding icodeconverter HDR MIME Mail header implementation MIME Mailhead Header line

The Headertokenizer Mail Draft Differential Class implements each element of the MIME mail head, such as Content-Type's MIMETYPE and various parameters.

IMIMEPART MIME mail segment body interface class mail segment class base class

MIMEBODYPART MIME Mail Section Class Implement MIME Mail Each Segment Class IMIMEPART MIMEMEPARME MIME MIME Mail Mergent ImimePart Imultipart Multi-Partial Interface Multiple Class Based Categories

MIMEMULTIPART Multi-Partial Implementation Class Save Segment Physical Class Image ImuLtipart InternetAddress MIME Mail Address Class implementation MIME mail address class

InternetHeaders MIME Mail head classification to save the container class of MIME

MAILDATEFORMAT Email Time Translation Class Implementation MIME Mail Format Time Conversion

MAILDATEPARSER Time Decomposition Processing Class Implementation Decomposition of MIME Mail Format

MIMEINIALIZATION Mail Analysis Global Initialization Class Implementation MIME Mail Use Various Global Variables

MIMETYPESFILETYPEMAP Mail MIME Type Map Class Map Map MiMetype and FileType type mapping table for query

MIMEUTILITY MIME Mail Analysis Tool class implements the parsing tool function for mail parsing

ParameterList Parameter List Class Implement the parameter list for ContentType and ContentDisPosition

SystemProperty System Environment Class Implementation Reading System Environmental Parameters

UniqueValue Mail Unique Value Generates Classes Generate the unique value for MIME mail, such as Boundary, etc.

3.2 class diagram

3.3 MIMEMESSAGE class

Now introducing the most important thing is the class mimeMessage that provides the main call interface API.

MIMEMessage provides a range of methods for use, such as defining a structure that acquiring address information and acquiring message text content (which can be a MIMEMULTIPART object for specific data), used to implement RFC822 and MIME specifications.

A mail content data is saved in a mimeMessage object, as well as some properties that record specific email addresses (such as Sender and Recipients). There is also a structural information of this message, as well as a content-type of its mail main body (body). The following is to describe the possible structure inside the MIMEMessage object:

3.4 MIMEMESSAGE class structure diagram

. . . Last continued

4 reference

[1] "JavaMail 1.2"

[2] "JavaMailTM API Design Specification Version 1.2"

[3] "C network programming volume 1: use ACE and mode elimination complexity"

[4] http://www.faqs.org/rfcs/

转载请注明原文地址:https://www.9cbs.com/read-105077.html

New Post(0)