C# Class RemObjects.InternetPack.Messages.Mime.MessagePart

A MessagePart is a part of an email message used to describe the whole email parse tree.

Email messages are tree structures:
Email messages may contain large tree structures, and the MessagePart are the nodes of the this structure.
A MessagePart may either be a leaf in the structure or a internal node with links to other MessageParts.
The root of the message tree is the MimeMessage class.

Leafs:
If a MessagePart is a leaf, the part is not a MultiPart message.
Leafs are where the contents of an email are placed.
This includes, but is not limited to: attachments, text or images referenced from HTML.
The content of an attachment can be fetched by using the Body property.
If you want to have the text version of a MessagePart, use the GetBodyAsText method which will
convert the Body into a String using the encoding the message was sent with.

Internal nodes:
If a MessagePart is an internal node in the email tree structure, then the part is a MultiPart message.
The MessageParts property will then contain links to the parts it contain.
The Body property of the MessagePart will not be set.

See the example for a parsing example.
This class cannot be instantiated from outside the library.
Afficher le fichier Open project: remobjects/internetpack Class Usage Examples

Méthodes publiques

Méthode Description
GetBodyAsText ( ) : String

Gets this MessagePart's Body as text.
This is simply the BodyEncoding being used on the raw bytes of the Body property.
This method is only valid to call if it is not a MultiPart message and therefore contains a body.

MessagePart ( Byte rawBody, MessageHeader headers ) : System

Used to construct the topmost message part

ToHttpResponseBody ( StringBuilder builder ) : void

Private Methods

Méthode Description
DecodeBody ( Byte messageBody, ContentTransferEncoding contentTransferEncoding ) : Byte[]

Decodes a Byte array into another Byte array based upon the Content Transfer encoding

FindFileName ( ContentType contentType, ContentDisposition contentDisposition, String defaultName ) : String

Figures out the filename of this message part from some headers. FileName property.

FindPositionOfNextMultiPartBoundary ( Stream stream, String multiPartBoundary, System.Boolean &lastMultipartBoundaryFound ) : Int32

Method that is able to find a specific MultiPart boundary in a Stream.
The Stream passed should not be used for anything else then for looking for MultiPart boundaries The stream to find the next MultiPart boundary in. Do not use it for anything else then with this method. The MultiPart boundary to look for. This should be found in the ContentType header Is set to if the next MultiPart boundary was indicated to be the last one, by having -- appended to it. Otherwise set to

GetMessagePart ( Byte rawMessageContent ) : MessagePart

Given a Byte array describing a full message.
Parses the Byte array into a MessagePart.

GetMultiPartParts ( Byte rawBody, String multipPartBoundary ) : List

Gets a list of Byte arrays where each entry in the list is a full message of a message part

ParseBody ( Byte rawBody ) : void

Parses a Byte array as a body of an email message.

ParseBodyEncoding ( String characterSet ) : Encoding

Parses a character set into an encoding

ParseMultiPartBody ( Byte rawBody ) : void

Parses the rawBody Byte array as a MultiPart message.
It is not valid to call this method if IsMultiPart returned .
Fills the MessageParts property of this MessagePart.

Method Details

GetBodyAsText() public méthode

Gets this MessagePart's Body as text.
This is simply the BodyEncoding being used on the raw bytes of the Body property.
This method is only valid to call if it is not a MultiPart message and therefore contains a body.
public GetBodyAsText ( ) : String
Résultat String

MessagePart() public méthode

Used to construct the topmost message part
If or is
public MessagePart ( Byte rawBody, MessageHeader headers ) : System
rawBody Byte The body that needs to be parsed
headers RemObjects.InternetPack.Messages.Mime.Header.MessageHeader The headers that should be used from the message
Résultat System

ToHttpResponseBody() public méthode

public ToHttpResponseBody ( StringBuilder builder ) : void
builder StringBuilder
Résultat void