C# Class MimeKit.Header

A class representing a Message or MIME header.
Represents a single header field and value pair.
Afficher le fichier Open project: jstedfast/MimeKit Class Usage Examples

Méthodes publiques

Méthode Description
Clone ( ) : Header

Clone the header.

Clones the header, copying the current RawValue.

GetValue ( Portable.Text.Encoding encoding ) : string

Gets the header value using the specified character encoding.

If the raw header value does not properly encode non-ASCII text, the decoder will fall back to a default charset encoding. Sometimes, however, this default charset fallback is wrong and the mail client may wish to override that default charset on a per-header basis.

By using this method, the client is able to override the fallback charset on a per-header basis.

GetValue ( string charset ) : string

Gets the header value using the specified charset.

If the raw header value does not properly encode non-ASCII text, the decoder will fall back to a default charset encoding. Sometimes, however, this default charset fallback is wrong and the mail client may wish to override that default charset on a per-header basis.

By using this method, the client is able to override the fallback charset on a per-header basis.

Header ( HeaderId id, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair with the UTF-8 encoding.

Header ( Portable.Text.Encoding encoding, HeaderId id, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.

Header ( Portable.Text.Encoding encoding, string field, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.

Header ( string charset, HeaderId id, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.

Header ( string field, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair with the UTF-8 encoding.

Header ( string charset, string field, string value ) : System

Initializes a new instance of the MimeKit.Header class.

Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.

SetValue ( MimeKit.FormatOptions format, Portable.Text.Encoding encoding, string value ) : void

Sets the header value using the specified formatting options and character encoding.

When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.

SetValue ( MimeKit.FormatOptions format, string charset, string value ) : void

Sets the header value using the specified formatting options and charset.

When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.

SetValue ( Portable.Text.Encoding encoding, string value ) : void

Sets the header value using the specified character encoding.

When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.

SetValue ( string charset, string value ) : void

Sets the header value using the specified charset.

When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.

ToString ( ) : string

Returns a string representation of the header.

Formats the header field and value in a way that is suitable for display.

TryParse ( ParserOptions options, byte buffer, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the specified buffer.

TryParse ( ParserOptions options, byte buffer, int startIndex, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the supplied buffer starting at the specified index.

TryParse ( ParserOptions options, byte buffer, int startIndex, int length, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the supplied buffer starting at the given index and spanning across the specified number of bytes.

TryParse ( ParserOptions options, string text, Header &header ) : bool

Tries to parse the given text into a new MimeKit.Header instance.

Parses a header from the specified text.

TryParse ( byte buffer, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the specified buffer.

TryParse ( byte buffer, int startIndex, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the supplied buffer starting at the specified index.

TryParse ( byte buffer, int startIndex, int length, Header &header ) : bool

Tries to parse the given input buffer into a new MimeKit.Header instance.

Parses a header from the supplied buffer starting at the given index and spanning across the specified number of bytes.

TryParse ( string text, Header &header ) : bool

Tries to parse the given text into a new MimeKit.Header instance.

Parses a header from the specified text.

Unfold ( string text ) : string

Unfold the specified header value.

Unfolds the header value so that it becomes suitable for display. Since Value is already unfolded, this method is really only needed when working with raw header strings.

Private Methods

Méthode Description
EncodeAddressHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeContentDisposition ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeContentType ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeDkimHeaderList ( MimeKit.FormatOptions format, StringBuilder encoded, int &lineLength, string value, char delim ) : void
EncodeDkimLongValue ( MimeKit.FormatOptions format, StringBuilder encoded, int &lineLength, string value ) : void
EncodeDkimSignatureHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeMessageIdHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeReceivedHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeReferencesHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
EncodeUnstructuredHeader ( ParserOptions options, MimeKit.FormatOptions format, Portable.Text.Encoding charset, string field, string value ) : byte[]
Fold ( MimeKit.FormatOptions format, string field, string value ) : string
FormatRawValue ( MimeKit.FormatOptions format, Portable.Text.Encoding encoding ) : byte[]
GetRawValue ( MimeKit.FormatOptions format ) : byte[]
Header ( ParserOptions options, HeaderId id, string field, byte value ) : System
Header ( ParserOptions options, HeaderId id, string name, byte field, byte value ) : System
Header ( ParserOptions options, byte field, byte value ) : System
IsAsciiAtom ( byte c ) : bool
IsBlank ( byte c ) : bool
IsControl ( byte c ) : bool
IsWhiteSpace ( char c ) : bool
OnChanged ( ) : void
ReceivedTokenSkipAddress ( byte text, int &index ) : void
ReceivedTokenSkipAtom ( byte text, int &index ) : void
ReceivedTokenSkipDomain ( byte text, int &index ) : void
ReceivedTokenSkipMessageId ( byte text, int &index ) : void
TokenizeText ( string text ) : IEnumerable
TryParse ( ParserOptions options, byte input, int length, bool strict, Header &header ) : bool
WordBreak ( MimeKit.FormatOptions format, string word, int lineLength ) : IEnumerable

Method Details

Clone() public méthode

Clone the header.
Clones the header, copying the current RawValue.
public Clone ( ) : Header
Résultat Header

GetValue() public méthode

Gets the header value using the specified character encoding.

If the raw header value does not properly encode non-ASCII text, the decoder will fall back to a default charset encoding. Sometimes, however, this default charset fallback is wrong and the mail client may wish to override that default charset on a per-header basis.

By using this method, the client is able to override the fallback charset on a per-header basis.

public GetValue ( Portable.Text.Encoding encoding ) : string
encoding Portable.Text.Encoding The character encoding to use as a fallback.
Résultat string

GetValue() public méthode

Gets the header value using the specified charset.

If the raw header value does not properly encode non-ASCII text, the decoder will fall back to a default charset encoding. Sometimes, however, this default charset fallback is wrong and the mail client may wish to override that default charset on a per-header basis.

By using this method, the client is able to override the fallback charset on a per-header basis.

public GetValue ( string charset ) : string
charset string The charset to use as a fallback.
Résultat string

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair with the UTF-8 encoding.
/// is null. /// /// is not a valid . ///
public Header ( HeaderId id, string value ) : System
id HeaderId The header identifier.
value string The value of the header.
Résultat System

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.
/// is null. /// -or- /// is null. /// /// is not a valid . ///
public Header ( Portable.Text.Encoding encoding, HeaderId id, string value ) : System
encoding Portable.Text.Encoding The character encoding that should be used to /// encode the header value.
id HeaderId The header identifier.
value string The value of the header.
Résultat System

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// The contains illegal characters. ///
public Header ( Portable.Text.Encoding encoding, string field, string value ) : System
encoding Portable.Text.Encoding The character encoding that should be used /// to encode the header value.
field string The name of the header field.
value string The value of the header.
Résultat System

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.
/// is null. /// -or- /// is null. /// /// is not a valid . /// /// is not supported. ///
public Header ( string charset, HeaderId id, string value ) : System
charset string The charset that should be used to encode the /// header value.
id HeaderId The header identifier.
value string The value of the header.
Résultat System

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair with the UTF-8 encoding.
/// is null. /// -or- /// is null. /// /// The contains illegal characters. ///
public Header ( string field, string value ) : System
field string The name of the header field.
value string The value of the header.
Résultat System

Header() public méthode

Initializes a new instance of the MimeKit.Header class.
Creates a new message or entity header for the specified field and value pair. The encoding is used to determine which charset to use when encoding the value according to the rules of rfc2047.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// The contains illegal characters. /// /// is not supported. ///
public Header ( string charset, string field, string value ) : System
charset string The charset that should be used to encode the /// header value.
field string The name of the header field.
value string The value of the header.
Résultat System

SetValue() public méthode

Sets the header value using the specified formatting options and character encoding.
When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.
/// is null. /// -or- /// is null. /// -or- /// is null. ///
public SetValue ( MimeKit.FormatOptions format, Portable.Text.Encoding encoding, string value ) : void
format MimeKit.FormatOptions The formatting options.
encoding Portable.Text.Encoding A character encoding.
value string The header value.
Résultat void

SetValue() public méthode

Sets the header value using the specified formatting options and charset.
When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.
/// is null. /// -or- /// is null. /// -or- /// is null. /// /// is not supported. ///
public SetValue ( MimeKit.FormatOptions format, string charset, string value ) : void
format MimeKit.FormatOptions The formatting options.
charset string A charset encoding.
value string The header value.
Résultat void

SetValue() public méthode

Sets the header value using the specified character encoding.
When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.
/// is null. /// -or- /// is null. ///
public SetValue ( Portable.Text.Encoding encoding, string value ) : void
encoding Portable.Text.Encoding A character encoding.
value string The header value.
Résultat void

SetValue() public méthode

Sets the header value using the specified charset.
When a particular charset is desired for encoding the header value according to the rules of rfc2047, this method should be used instead of the Value setter.
/// is null. /// -or- /// is null. /// /// is not supported. ///
public SetValue ( string charset, string value ) : void
charset string A charset encoding.
value string The header value.
Résultat void

ToString() public méthode

Returns a string representation of the header.
Formats the header field and value in a way that is suitable for display.
public ToString ( ) : string
Résultat string

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the specified buffer.
/// is null. /// -or- /// is null. ///
public static TryParse ( ParserOptions options, byte buffer, Header &header ) : bool
options ParserOptions The parser options to use.
buffer byte The input buffer.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the supplied buffer starting at the specified index.
/// is null. /// -or- /// is null. /// /// is out of range. ///
public static TryParse ( ParserOptions options, byte buffer, int startIndex, Header &header ) : bool
options ParserOptions The parser options to use.
buffer byte The input buffer.
startIndex int The starting index of the input buffer.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the supplied buffer starting at the given index and spanning across the specified number of bytes.
/// is null. /// -or- /// is null. /// /// and do not specify /// a valid range in the byte array. ///
public static TryParse ( ParserOptions options, byte buffer, int startIndex, int length, Header &header ) : bool
options ParserOptions The parser options to use.
buffer byte The input buffer.
startIndex int The starting index of the input buffer.
length int The number of bytes in the input buffer to parse.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given text into a new MimeKit.Header instance.
Parses a header from the specified text.
/// is null. /// -or- /// is null. ///
public static TryParse ( ParserOptions options, string text, Header &header ) : bool
options ParserOptions The parser options to use.
text string The text to parse.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the specified buffer.
/// is null. ///
public static TryParse ( byte buffer, Header &header ) : bool
buffer byte The input buffer.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the supplied buffer starting at the specified index.
/// is null. /// /// is out of range. ///
public static TryParse ( byte buffer, int startIndex, Header &header ) : bool
buffer byte The input buffer.
startIndex int The starting index of the input buffer.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given input buffer into a new MimeKit.Header instance.
Parses a header from the supplied buffer starting at the given index and spanning across the specified number of bytes.
/// is null. /// /// and do not specify /// a valid range in the byte array. ///
public static TryParse ( byte buffer, int startIndex, int length, Header &header ) : bool
buffer byte The input buffer.
startIndex int The starting index of the input buffer.
length int The number of bytes in the input buffer to parse.
header Header The parsed header.
Résultat bool

TryParse() public static méthode

Tries to parse the given text into a new MimeKit.Header instance.
Parses a header from the specified text.
/// is null. ///
public static TryParse ( string text, Header &header ) : bool
text string The text to parse.
header Header The parsed header.
Résultat bool

Unfold() public static méthode

Unfold the specified header value.
Unfolds the header value so that it becomes suitable for display. Since Value is already unfolded, this method is really only needed when working with raw header strings.
public static Unfold ( string text ) : string
text string The header text.
Résultat string