# Class TMimeMess

Description | Hierarchy | Fields | Methods | Properties

## Unit

mimemess

## Declaration

`type TMimeMess = class(TObject)`

## Description

Object for handling of e-mail message.

## Hierarchy

- TObject
- TMimeMess

## Overview

### Methods

| `constructor Create;`
| `constructor CreateAltHeaders(HeadClass: TMessHeaderClass);`
| `destructor Destroy; override;`
| `procedure Clear; virtual;`
| `function AddPart(const PartParent: TMimePart): TMimePart;`
| `function AddPartMultipart(const MultipartType: String; const PartParent: TMimePart): TMimePart;`
| `function AddPartText(const Value: TStrings; const PartParent: TMimePart): TMimepart;`
| `function AddPartTextEx(const Value: TStrings; const PartParent: TMimePart; PartCharset: TMimeChar; Raw: Boolean; PartEncoding: TMimeEncoding): TMimepart;`
| `function AddPartHTML(const Value: TStrings; const PartParent: TMimePart): TMimepart;`
| `function AddPartTextFromFile(const FileName: String; const PartParent: TMimePart): TMimepart;`
| `function AddPartHTMLFromFile(const FileName: String; const PartParent: TMimePart): TMimepart;`
| `function AddPartBinary(const Stream: TStream; const FileName: string; const PartParent: TMimePart): TMimepart;`
| `function AddPartBinaryFromFile(const FileName: string; const PartParent: TMimePart): TMimepart;`
| `function AddPartHTMLBinary(const Stream: TStream; const FileName, Cid: string; const PartParent: TMimePart): TMimepart;`
| `function AddPartHTMLBinaryFromFile(const FileName, Cid: string; const PartParent: TMimePart): TMimepart;`
| `function AddPartMess(const Value: TStrings; const PartParent: TMimePart): TMimepart;`
| `function AddPartMessFromFile(const FileName: string; const PartParent: TMimePart): TMimepart;`
| `procedure EncodeMessage;`
| `procedure DecodeMessage;`
| `procedure DecodeMessageBinary(AHeader:TStrings; AData:TMemoryStream);`

### Properties

| `property MessagePart: TMimePart read FMessagePart;`
| `property Lines: TStringList read FLines;`
| `property Header: TMessHeader read FHeader;`

## Description

### Methods

| `constructor Create;`

| `constructor CreateAltHeaders(HeadClass: TMessHeaderClass);`

create this object and assign your own descendant of TMessHeader object to Header property. So, you can create your own message headers parser and use it by this object.

| `destructor Destroy; override;`

| `procedure Clear; virtual;`

Reset component to default state.

| `function AddPart(const PartParent: TMimePart): TMimePart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then one subpart, you must have PartParent of multipart type!

| `function AddPartMultipart(const MultipartType: String; const PartParent: TMimePart): TMimePart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

This part is marked as multipart with secondary MIME type specified by MultipartType parameter. (typical value is 'mixed')

This part can be used as PartParent for another parts (include next multipart). If you need only one part, then you not need Multipart part.

| `function AddPartText(const Value: TStrings; const PartParent: TMimePart): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to text part and set all necessary properties. Content of part is readed from value stringlist.

| `function AddPartTextEx(const Value: TStrings; const PartParent: TMimePart; PartCharset: TMimeChar; Raw: Boolean; PartEncoding: TMimeEncoding): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to text part and set all necessary properties. Content of part is readed from value stringlist. You can select your charset and your encoding type. If Raw is `True`, then it not doing charset conversion!

| `function AddPartHTML(const Value: TStrings; const PartParent: TMimePart): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to text part to HTML type and set all necessary properties. Content of HTML part is readed from Value stringlist.

| `function AddPartTextFromFile(const FileName: String; const PartParent: TMimePart): TMimepart;`

Same as AddPartText, but content is readed from file

| `function AddPartHTMLFromFile(const FileName: String; const PartParent: TMimePart): TMimepart;`

Same as AddPartHTML, but content is readed from file

| `function AddPartBinary(const Stream: TStream; const FileName: string; const PartParent: TMimePart): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to binary and set all necessary properties. MIME primary and secondary types defined automaticly by filename extension. Content of binary part is readed from Stream. This binary part is encoded as file attachment.

| `function AddPartBinaryFromFile(const FileName: string; const PartParent: TMimePart): TMimepart;`

Same as AddPartBinary, but content is readed from file

| `function AddPartHTMLBinary(const Stream: TStream; const FileName, Cid: string; const PartParent: TMimePart): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to binary and set all necessary properties. MIME primary and secondary types defined automaticly by filename extension. Content of binary part is readed from Stream.

This binary part is encoded as inline data with given Conten ID (cid). Content ID can be used as reference ID in HTML source in HTML part.

| `function AddPartHTMLBinaryFromFile(const FileName, Cid: string; const PartParent: TMimePart): TMimepart;`

Same as AddPartHTMLBinary, but content is readed from file

| `function AddPartMess(const Value: TStrings; const PartParent: TMimePart): TMimepart;`

Add MIME part as subpart of PartParent. If you need set root MIME part, then set as PartParent `Nil` value. If you need set more then 1 subpart, you must have PartParent of multipart type!

After creation of part set type to message and set all necessary properties. MIME primary and secondary types are setted to 'message/rfc822'. Content of raw RFC-822 message is readed from Stream.

| `function AddPartMessFromFile(const FileName: string; const PartParent: TMimePart): TMimepart;`

Same as AddPartMess, but content is readed from file

| `procedure EncodeMessage;`

Compose message from MessagePart to Lines. Headers from Header object is added also.

| `procedure DecodeMessage;`

Decode message from Lines to MessagePart. Massage headers are parsed into Header object.

| `procedure DecodeMessageBinary(AHeader:TStrings; AData:TMemoryStream);`

HTTP message is received by THTTPSend component in two parts: headers are stored in THTTPSend.Headers and a body in memory stream THTTPSend.Document.

On the top of it, HTTP connections are always 8-bit, hence data are transferred in native format i.e. no transfer encoding is applied.

This method operates the similiar way and produces the same result as DecodeMessage.

### Properties

| `property MessagePart: TMimePart read FMessagePart;`

TMimePart object with decoded MIME message. This object can handle any number of nested TMimePart objects itself. It is used for handle any tree of MIME subparts.

| `property Lines: TStringList read FLines;`

Raw MIME encoded message.

| `property Header: TMessHeader read FHeader;`

Object for e-mail header fields. This object is created automaticly. Do not free this object!

Generated by PasDoc 0.9.0 on 2012-04-23 21:38:51