Hunny Software Library Reference

Body Class

Class that represents the body of a message or body part.

For a list of all members of this type, see Body Members.

System.Object
   Node
      Body

[Visual Basic]
Public Class Body
Inherits Node
[C#]
public class Body : Node

Remarks

Body represents a body, as described in RFC 2045. A body is always part of an entity, which may be either a message or a body part. If the content type of an entity is "multipart/*", then the body contains one or more body parts. If the content type is "message/rfc822", then the body contains an encapsulated message. For all other content types, the body contains a string of bytes, which may be text or some other kind of binary data.

In Hunny MIME.NET, a Body object is contained in an Entity object. The Body object may contain a discrete body consisting only of a string of bytes, or it may be a composite body, consisting of several contained BodyPart objects or a single contained Message object. The only reliable way to determine the type of Body is to access the Content-Type header field from the Headers object of the Entity that contains it. For this reason, a Body should always be part of a Entity.

In the document tree representation of a message, a Body object can be an intermediate node, having both a parent node and one or more child nodes, or a leaf node, having a parent but no child nodes. In either case, the parent node is the Entity object that contains it. If it is an intermediate node, it must be of type "multipart/*" with BodyPart objects as child nodes, or of type "message/rfc822" with a single Message object as its child node. (See the documentation for Node for a discussion of the tree representation of a message.)

Normally, you do not create a Body object directly, but you access it through the Body property of Entity, which creates the Body object for you.

To add a BodyPart to a multipart Body, call the AddBodyPart() method or the InsertBodyPartAt() method. To get the number of body parts, retrieve the NumBodyParts property. To access a particular body part, call BodyPartAt(). To remove a single body part, call RemoveBodyPartAt(). To remove and delete all body parts, call DeleteAllBodyParts().

To get the Message object contained in a Body object with "message/rfc822" content type, retrieve the Message property. To set the contained message, set the Message property.

To get or set the string of bytes in a discrete body, get or set the String property inherited from Node.

Requirements

Namespace: Hunny.Mime

Assembly: Hunny.Mime (in Hunny.Mime.dll)

See Also

Body Members | Hunny.Mime Namespace