• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class MailHeaderCollection

A case-insensitive collection of MailHeader objects parsed from a message's transport headers (PidTagTransportMessageHeaders). Header names are matched using OrdinalIgnoreCase.

Inheritance
object
MailHeaderCollection
Implements
IEnumerable<MailHeader>
IEnumerable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Mapi
Assembly: DRIT.Mail.dll
Syntax
public sealed class MailHeaderCollection : IEnumerable<MailHeader>, IEnumerable
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

Constructors

View Source

MailHeaderCollection()

Initializes a new empty instance of the MailHeaderCollection class.

Declaration
public MailHeaderCollection()
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

Properties

View Source

Count

Gets the number of headers in the collection.

Declaration
public int Count { get; }
Property Value
Type Description
int
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

this[int]

Gets the value of the header at the specified index.

Declaration
public string? this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
string
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

this[string]

Gets the first header with the specified name, or null if not found. The lookup is case-insensitive.

Declaration
public MailHeader? this[string name] { get; }
Parameters
Type Name Description
string name
Property Value
Type Description
MailHeader
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

Methods

View Source

Add(MailHeader)

Adds a copy of the specified header to the collection.

Declaration
public void Add(MailHeader header)
Parameters
Type Name Description
MailHeader header

The header to add.

Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

Add(string, string)

Adds a header to the collection.

Declaration
public void Add(string name, string value)
Parameters
Type Name Description
string name

The header field name.

string value

The header value.

Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

Clear()

Removes all headers from the collection.

Declaration
public void Clear()
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

Contains(string)

Determines whether a header with the specified name exists.

Declaration
public bool Contains(string name)
Parameters
Type Name Description
string name

The header field name to locate.

Returns
Type Description
bool
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

GetAll(string)

Gets all headers with the specified name.

Declaration
public IReadOnlyList<MailHeader> GetAll(string name)
Parameters
Type Name Description
string name

The header field name to locate.

Returns
Type Description
IReadOnlyList<MailHeader>
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

GetDecodedValue(string)

Gets the RFC 2047 decoded value of the first header with the specified name, or null.

Declaration
public string? GetDecodedValue(string name)
Parameters
Type Name Description
string name

The header field name to locate.

Returns
Type Description
string
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public IEnumerator<MailHeader> GetEnumerator()
Returns
Type Description
IEnumerator<MailHeader>
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

GetValue(string)

Gets the raw value of the first header with the specified name, or null.

Declaration
public string? GetValue(string name)
Parameters
Type Name Description
string name

The header field name to locate.

Returns
Type Description
string
Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

Remove(string)

Removes all headers with the specified name.

Declaration
public void Remove(string name)
Parameters
Type Name Description
string name

The header field name to remove.

Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

View Source

Set(string, string)

Replaces all headers with the specified name with a single header.

Declaration
public void Set(string name, string value)
Parameters
Type Name Description
string name

The header field name.

string value

The header value.

Remarks

When created through TransportMessageHeaders the collection is a live view: any mutation (Add(string, string), Remove(string), Value setter) writes the rebuilt header block back to TransportMessageHeaders.

Header folding (RFC 5322 §2.2.3) is unfolded on parse; RFC 2047 encoded words are preserved in Value and exposed decoded through DecodedValue / GetDecodedValue(string).

Implements

IEnumerable<T>
IEnumerable
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX