MimeAnonymizerAnonymize(MimeEntity, Stream) Method

Anonymize a MimeEntity.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public void Anonymize(
	MimeEntity entity,
	Stream stream
)

Parameters

entity  MimeEntity
The MIME entity to anonymize.
stream  Stream
The stream to write the anonymized entity to.

Remarks

Writes an anonymized version of the entity to a stream.

Example

C#
                    public static void AnonymizeFirstBodyPart (MimeMessage message, Stream output)
{
    // An individual MIME entity can be anonymized as well, which is useful when only
    // one part of a message is relevant.
    var entity = message.BodyParts.First ();
    var anonymizer = new MimeAnonymizer ();

    anonymizer.Anonymize (entity, output);
}

// Given a message whose first body part is:
//
// Content-Type: text/plain; charset=utf-8
// Content-Transfer-Encoding: 7bit
//
// Hey Chandler,
//
// Monica and I are going to play paintball on Saturday. You in?
//
// -- Joey
//
// The anonymized output will be:
//
// Content-Type: text/plain; charset=utf-8
// Content-Transfer-Encoding: 7bit
//
// xxx xxxxxxxxx
//
// xxxxxx xxx x xxx xxxxx xx xxxx xxxxxxxxx xx xxxxxxxxx xxx xxx
//
// xx xxxx
                  

Exceptions

ArgumentNullException

entity is .

-or-

stream is .

See Also